Example usage for junit.framework Assert assertTrue

List of usage examples for junit.framework Assert assertTrue

Introduction

In this page you can find the example usage for junit.framework Assert assertTrue.

Prototype

static public void assertTrue(boolean condition) 

Source Link

Document

Asserts that a condition is true.

Usage

From source file:com.comcast.cats.jenkins.service.BuildServiceIT.java

public void stopBuild() throws HttpException, IOException, InterruptedException {
    // stop build
    boolean status = buildService.stopBuild(jobName);
    LOGGER.info(" status is " + status);
    Assert.assertTrue(status);

}

From source file:org.atemsource.atem.impl.common.attribute.ListAssociationAttributeTest.java

@Test
public void testGetter() {
    EntityA entity = new EntityA();
    final ArrayList<EntityB> list = new ArrayList<EntityB>();
    entity.setList(list);//from w  ww.j av  a  2 s. c  o  m
    entity.getList().add(createEntity("Hallo", 2));
    entity.getList().add(createEntity("tst", 3));

    Attribute attribute = getAttribute(PROPERTY);
    Assert.assertNotNull(attribute);
    Object value = attribute.getValue(entity);
    assertEquals(list, value);
    Assert.assertTrue(list == value);

}

From source file:org.jasig.ssp.util.importer.job.BatchInitializerTest.java

@Test
public void testCreateDirectories() throws Exception {

    deleteDirectory(processDirectoryPath);
    deleteDirectory(upsertDirectoryPath);
    createFiles(inputDirectoryPath);//  ww w.  j a  v a 2s. co  m

    Assert.assertTrue(!directoryExists(processDirectoryPath));
    Assert.assertTrue(!directoryExists(upsertDirectoryPath));
    Assert.assertTrue(directoryExists(inputDirectoryPath));
    Assert.assertTrue(directoryContainsFiles(inputDirectoryPath, 2));

    BatchStatus status = jobLauncherTestUtils.launchJob().getStatus();

    Assert.assertTrue(directoryExists(processDirectoryPath));
    Assert.assertTrue(directoryExists(upsertDirectoryPath));
    Assert.assertTrue(directoryExists(inputDirectoryPath));
    Assert.assertTrue(directoryContainsFiles(processDirectoryPath, 2));
    Assert.assertTrue(directoryContainsFiles(upsertDirectoryPath, 0));
    Assert.assertTrue(directoryContainsFiles(inputDirectoryPath, 0));
    Assert.assertEquals(BatchStatus.COMPLETED, status);
}

From source file:at.uni_salzburg.cs.ckgroup.cscpp.mapper.registry.RegistryPersistenceTestCase.java

@Test
public void test() throws IOException, ParseException {
    URL storage = RegistryPersistenceTestCase.class.getResource("storage01.dat");
    File storagePath = new File(storage.getPath());

    Map<String, IRegistrationData> registrationData = new HashMap<String, IRegistrationData>();
    RegistryPersistence.loadRegistry(storagePath, registrationData);
    IRegistrationData d1 = registrationData.get("http://localhost:8080/engine");
    Assert.assertNotNull(d1);//from  w ww  .ja v a 2  s . c om
    String engineUri = d1.getEngineUrl();
    Assert.assertEquals("http://localhost:8080/engine", engineUri);

    String pilotUri = d1.getPilotUrl();
    Assert.assertEquals("http://localhost:8080/pilot", pilotUri);

    Set<String> sensors = d1.getSensors();
    Assert.assertEquals(7, sensors.size());
    Assert.assertTrue(sensors.contains("sonar"));
    Assert.assertTrue(sensors.contains("position"));
    Assert.assertTrue(sensors.contains("random"));
    Assert.assertTrue(sensors.contains("photo"));
    Assert.assertTrue(sensors.contains("video"));
    Assert.assertTrue(sensors.contains("airPressure"));
    Assert.assertTrue(sensors.contains("temperature"));

    List<IWayPoint> wayPoints = d1.getWaypoints();
    Assert.assertEquals(17, wayPoints.size());

    Assert.assertTrue(wayPoints.get(0) instanceof WayPoint);
    WayPoint wayPoint = (WayPoint) wayPoints.get(0);

    System.out.println("test() " + wayPoint.toJSONString());

    Assert.assertEquals(
            "{\"precision\":1.0,\"altitude\":1.0,\"velocity\":1.0,\"longitude\":13.04092571,\"latitude\":47.82204197}",
            wayPoint.toJSONString());
    Assert.assertEquals("(47.82204197, 13.04092571, 1.000) precision 1 velocity 1.0",
            wayPoints.get(0).toString());

    File tmpFile = File.createTempFile("mapper", ".dat");
    RegistryPersistence.storeRegistry(tmpFile, registrationData);

    String expected = FileUtils.loadFileAsString(storagePath);
    Assert.assertEquals(1860, expected.length());

    String actual = FileUtils.loadFileAsString(tmpFile);
    Assert.assertEquals(1860, actual.length());

    Assert.assertEquals(expected, actual);
    tmpFile.delete();
}

From source file:BQJDBC.QueryResultTest.Timeouttest.java

@Test
public void isvalidtest() {
    try {
        Assert.assertTrue(Timeouttest.con.isValid(0));
    } catch (SQLException e) {

    }
}

From source file:org.ocpsoft.rewrite.faces.DeferredOperationTest.java

@Test
public void testDeferOperationForward() throws Exception {
    HttpAction<HttpGet> action = get("/forward");
    String content = action.getResponseContent();
    Assert.assertTrue(content == null || content.isEmpty());
    Assert.assertEquals(202, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertEquals("True", action.getResponseHeaderValues("Forward-Occurred").get(0));
    Assert.assertEquals("/forward", action.getCurrentContextRelativeURL());
}

From source file:com.facebook.TestUtils.java

public static void assertSamePermissions(final Collection<String> expected, final AccessToken actual) {
    if (expected == null) {
        Assert.assertEquals(null, actual.getPermissions());
    } else {//from w w w.jav a 2 s . c o m
        for (String p : expected) {
            Assert.assertTrue(actual.getPermissions().contains(p));
        }
        for (String p : actual.getPermissions()) {
            Assert.assertTrue(expected.contains(p));
        }
    }
}

From source file:eagle.dataproc.util.TestConfigOptionParser.java

@Test
public void testValidCommandArgumentsAsSystem() throws ParseException {
    String[] arguments = new String[] { "-D", "key1=value1", "-D", "key2=value2", "-D", "key3=value3=something",
            "-D", "key4=", };

    new ConfigOptionParser().load(arguments);

    Assert.assertTrue(System.getProperties().containsKey("key1"));
    Assert.assertTrue(System.getProperties().containsKey("key2"));
    Assert.assertTrue(System.getProperties().containsKey("key3"));
    Assert.assertTrue(System.getProperties().containsKey("key4"));

    Assert.assertEquals("value1", System.getProperty("key1"));
    Assert.assertEquals("value2", System.getProperty("key2"));
    Assert.assertEquals("value3=something", System.getProperty("key3"));
    Assert.assertEquals("", System.getProperty("key4"));
}

From source file:piecework.content.concrete.RemoteResourceTest.java

@Test
public void verifyContentLength() throws IOException {
    Assert.assertTrue(remoteResource.contentLength() > 1);
}

From source file:org.ocpsoft.rewrite.prettyfaces.encoding.URLEncodingTest.java

/**
 * Test a rewrite rule using the 'substitute' attribute to modify the URL.
 * // ww  w.  j a  v a2s .  c  om
 * @see http://code.google.com/p/prettyfaces/issues/detail?id=76
 */
@Test
public void testRewriteEncodingSubstitute() throws Exception {
    String target = "/virtual/rewrite/substitute";
    String expected = "/virtu%C3%A1ln%C3%AD";

    HttpAction<HttpGet> action = get(target);

    String responseContent = action.getResponseContent();
    Assert.assertTrue(responseContent.contains(action.getContextPath() + expected));
}