Example usage for org.springframework.util Assert isTrue

List of usage examples for org.springframework.util Assert isTrue

Introduction

In this page you can find the example usage for org.springframework.util Assert isTrue.

Prototype

@Deprecated
public static void isTrue(boolean expression) 

Source Link

Document

Assert a boolean expression, throwing an IllegalArgumentException if the expression evaluates to false .

Usage

From source file:org.vertx.mods.examples.ExampleExtendsSpringModBase.java

@Override
protected void afterStartApplicationContext() {

    // Example trivial usage of a bean lookup
    ApplicationContext context = super.getApplicationContext();
    Vertx vertx = context.getBean("vertx", Vertx.class);

    Assert.isTrue(super.vertx == vertx);
}

From source file:im.tym.wraop.noaspectj.WrapperFactoryBuilderTest.java

@Test
public void testDetection() {
    Assert.isTrue(!WrapperFactoryBuilder.ASPECTJ_AVAILABLE);
    Assert.isTrue(WrapperFactoryBuilder.SPRING_AOP_AVAILABLE);
}

From source file:de.olivergierke.whoops.customer.CustomerNumber.java

/**
 * Creates a new {@link CustomerNumber} from the given {@link String}.
 * //from  w  ww  .j  a  v  a2s . co  m
 * @param number must not be {@literal null} or empty.
 */
CustomerNumber(String number) {

    Assert.isTrue(isValid(number));
    this.number = number;
}

From source file:sample.SampleTest.java

@Test(expected = IllegalArgumentException.class)
public void sampleNegativeTest() {
    Assert.isTrue(false);
}

From source file:de.olivergierke.whoops.domain.customer.CustomerNumber.java

/**
 * Creates a new {@link CustomerNumber} from the given {@link String}.
 * //from ww  w . j av a 2 s.  c  o m
 * @param number must not be {@literal null} or empty.
 */
public CustomerNumber(String number) {

    Assert.isTrue(isValid(number));
    this.number = number;
}

From source file:org.esco.portlet.flashinfo.dao.impl.MockFlashInfoResourceImpl.java

private List<FlashInfo> getServiceInfos(String url) {
    if (log.isDebugEnabled()) {
        log.debug("Requesting Flash Infos on URL {}", url);
    }/*from   w  ww . j  a  v a2  s .  c  o m*/

    Assert.isTrue(url.matches("^https?://[a-z0-9+.-]+(:[0-9]{1,4})?/.*"));

    List<FlashInfo> flL = new ArrayList<>();

    for (int i = 0; i < 5; i++) {
        final String imgL = "https//my.domain.com/images/test_" + i + ".png";
        final String title = "un titre " + i;
        final String text = "un text " + i;
        final String kml = "https//my.domain.com/test_" + i;
        final String alt = title;
        final FlashInfo info = new FlashInfo(imgL, title, text, kml, alt);
        flL.add(info);
    }
    return flL;
}

From source file:io.kahu.hawaii.domain.StringProperty.java

public StringProperty(String value, Integer minLength, Integer maxLength) {
    super(value);

    if (minLength != null) {
        this.minLength = minLength.intValue();
    }/*from  www .  ja va2 s  . com*/
    if (maxLength != null) {
        this.maxLength = maxLength.intValue();
        Assert.isTrue(maxLength > 0);
    }
    if (minLength != null && maxLength != null) {
        Assert.isTrue(minLength <= maxLength);
    }
}

From source file:com.github.spring.example.ImageService.java

@Cacheable("qr-code-cache")
public byte[] generateQRCode(String text, int width, int height) throws WriterException, IOException {

    Assert.hasText(text);/*from   ww  w . j  a  v a2s  .c  om*/
    Assert.isTrue(width > 0);
    Assert.isTrue(height > 0);

    LOGGER.info("Will generate image  text=[{}], width=[{}], height=[{}]", text, width, height);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitMatrix matrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height);
    MatrixToImageWriter.writeToStream(matrix, MediaType.IMAGE_PNG.getSubtype(), baos,
            new MatrixToImageConfig());
    return baos.toByteArray();
}

From source file:com.mike.angry.main.SolverResultOutput.java

public static void printResult(DataModel dataModel) {
    // ??/*w  w w . j  a  v a 2  s .co m*/
    log.info("puzzle:" + dataModel.getPath() + "\t");
    String abc = DataModelStatusHelper.isSolved(dataModel) ? "?"
            : "";
    log.info(abc);
    for (int i = 0; i < 9; i++) {
        StringBuffer oneline = new StringBuffer("");
        for (int j = 0; j < 9; j++) {
            Digital digital = dataModel.getBigSquare()[i][j];
            if (digital.isDetermined()) {
                oneline.append(digital.getNumber() + ",");
            } else {
                oneline.append("?,");
            }
        }
        log.info("line " + i + ":\t " + oneline.toString());
    }

    // 
    log.info("=============\n");

    StringBuffer oneline = new StringBuffer("\n");

    int total = processRuleResolveResult(oneline, dataModel);
    log.info("?" + dataModel.getInitValued() + "\t" + "" + total + "\t"
            + "" + DataModelStatusHelper.calcNotFound(dataModel) + "!");
    log.info(oneline);

    Assert.isTrue(81 == dataModel.getInitValued() + total + DataModelStatusHelper.calcNotFound(dataModel));
    // ?
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            log.debug(dataModel.getBigSquare()[i][j].toString());
        }
    }
}

From source file:com.carlomicieli.jtrains.value.objects.Length.java

private Length(DecimalNumber mm, DecimalNumber inches) {
    Assert.isTrue(mm.isPositive());
    Assert.isTrue(inches.isPositive());

    this.mm = mm;
    this.inches = inches;
}