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:org.jasig.ssp.util.importer.job.BatchFinalizerNoArchiveTest.java

@SuppressWarnings("unchecked")
@Test/*from   w  ww .  j av a  2s  . com*/
public void testFinalizeNoArchive() throws Exception {

    deleteDirectory(processDirectoryPath);
    deleteDirectory(upsertDirectoryPath);
    deleteDirectory(inputDirectoryPath);
    deleteDirectory(archiveDirectoryPath);
    createFiles(inputDirectoryPath);
    createFiles(upsertDirectoryPath);
    createFiles(processDirectoryPath);

    Assert.assertTrue(directoryContainsFiles(inputDirectoryPath, 3, csvFilter));
    Assert.assertTrue(directoryContainsFiles(upsertDirectoryPath, 3, csvFilter));
    Assert.assertTrue(directoryContainsFiles(processDirectoryPath, 3, csvFilter));

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

    Assert.assertTrue(directoryExists(processDirectoryPath));
    Assert.assertTrue(directoryExists(upsertDirectoryPath));
    Assert.assertTrue(directoryExists(inputDirectoryPath));
    Assert.assertTrue(!directoryExists(archiveDirectoryPath));
    Assert.assertTrue(directoryContainsFiles(processDirectoryPath, 0, csvFilter));
    Assert.assertTrue(directoryContainsFiles(upsertDirectoryPath, 0, csvFilter));
    Assert.assertTrue(directoryContainsFiles(inputDirectoryPath, 0, csvFilter));
    Assert.assertEquals(BatchStatus.COMPLETED, exitStatus);
}

From source file:com.couchbase.lite.performance.Test6_PushReplication.java

public void testPushReplicationPerformance() throws Exception {

    if (!performanceTestsEnabled()) {
        return;/*  w ww .  j  a v  a 2  s  . c  o m*/
    }

    long startMillis = System.currentTimeMillis();

    URL remote = getReplicationURL();

    final Replication repl = database.createPushReplication(remote);
    repl.setContinuous(false);
    if (!isSyncGateway(remote)) {
        repl.setCreateTarget(true);
        Assert.assertTrue(repl.shouldCreateTarget());
    }

    runReplication(repl);

    Log.d(TAG, "testPusher() finished");

    Log.v("PerformanceStats", TAG + "," + Long.valueOf(System.currentTimeMillis() - startMillis).toString()
            + "," + getNumberOfDocuments());

}

From source file:org.envirocar.app.test.dao.TrackDecoderTest.java

public void testLocationParsing() throws TrackRetrievalException {
    HttpResponse resp = new BasicHttpResponse(createStatusLine());

    resp.setHeader("Location", "http:/this.is.my.envirocar.server/api/tracks/1337-resource");

    String result = new TrackDecoder().resolveLocation(resp);

    Assert.assertTrue(result.equals("1337-resource"));
}

From source file:es.tekniker.framework.ktek.commons.mng.server.test.TestCommonsMngServer.java

public void testLoadFile() {
    log.info("*************************************************************");
    log.info("testLoadFile: START ");

    CommonsMngServer mng = new CommonsMngServer();
    String result = TestDefines.RESULT_OK;

    boolean boolValid = false;
    String strfilename = null;//from  w  w  w  . j  a v  a2  s  .c o m
    try {

        strfilename = "dataLoadCommons_QSE.csv";

        boolValid = mng.loadfileData(strfilename);
        if (boolValid) {
            log.info("testLoadFile: Token Valid ");
            Assert.assertTrue(true);
        } else {
            log.error("testLoadFile: Token NO Valid ");
            Assert.assertTrue(false);
            result = TestDefines.RESULT_ERROR;
        }
    } catch (Exception e) {
        e.printStackTrace();
        log.error("testLoadFile EXCEPTION: " + e.getMessage());
        Assert.assertTrue(false);
        result = TestDefines.RESULT_EXCEPTION;
    }

    log.info("testLoadFile: RESULT " + result);
    log.info("testLoadFile: END ");
    log.info("*************************************************************");
    log.info("");

}

From source file:org.ocpsoft.rewrite.servlet.config.EncodeQueryConfigurationTest.java

@Test
public void testQueryEncodingInclusions() throws Exception {
    HttpAction<HttpGet> action = get("/encodequeryspecific?encode1=value1&keep=this&encode2=value2");
    Assert.assertEquals(210, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertTrue(action.getCurrentContextRelativeURL().contains("c="));
    Assert.assertTrue(action.getCurrentContextRelativeURL().contains("keep=this"));
    Assert.assertFalse(action.getCurrentContextRelativeURL().contains("encode1=value1"));
    Assert.assertFalse(action.getCurrentContextRelativeURL().contains("encode2=value2"));
}

From source file:org.ocpsoft.rewrite.servlet.container.ContainerSecurityTest.java

@Test
public void testContainerSecurityFunctionsWithRewriteUnHandled() throws Exception {
    HttpAction<HttpGet> action = get("/user/x");
    Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertTrue(action.getResponseContent().contains("LOGIN PAGE"));
}

From source file:com.feedzai.fos.impl.weka.WekaScorerTest.java

public void poolCreationTest() throws FOSException {
    BaseConfiguration configuration = new BaseConfiguration();
    configuration.setProperty(GenericObjectPoolConfig.class.getName() + ".minIdle", 10);
    configuration.setProperty(GenericObjectPoolConfig.class.getName() + ".maxActive", 10);
    configuration.setProperty(FosConfig.HEADER_LOCATION, "target/test-classes/models/threadsafe");
    configuration.setProperty(FosConfig.FACTORY_NAME, WekaManagerFactory.class.getName());

    WekaManagerConfig wekaManagerConfig = new WekaManagerConfig(new FosConfig(configuration));
    WekaManager wekaManager = new WekaManager(wekaManagerConfig);
    WekaScorer wekaScorer = wekaManager.getScorer();

    double[] score = wekaScorer.score(Lists.newArrayList(testUUID), new Object[] { 1.5, 0, "gray", "positive" })
            .get(0);//from   w ww.j a v  a2s .  c o m
    assertEquals(2, score.length);
    assertEquals(1.0, score[0] + score[1], 0.001);
    Assert.assertTrue(((Map<Integer, WekaThreadSafeScorer>) Whitebox.getInternalState(wekaScorer,
            "wekaThreadSafeScorers")).get(testUUID) instanceof WekaThreadSafeScorerPool);
}

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

@Test
public void testPhaseBindingDefersValue() throws Exception {
    HttpAction<HttpGet> action = get("/binding/lincoln");
    String content = action.getResponseContent();
    Assert.assertTrue(content == null || content.isEmpty());
    Assert.assertEquals(205, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertEquals("lincoln", action.getResponseHeaderValues("Value").get(0));
}

From source file:com.cloudant.sync.datastore.BasicDBBodyTest.java

@Test
public void constructor_emptyMap_objectWithEmptyJsonShouldBeCreated() {
    DocumentBody body = new BasicDocumentBody(new HashMap());
    Assert.assertTrue(Arrays.equals("{}".getBytes(), body.asBytes()));
    Assert.assertNotNull(body.asMap());/*from w ww .  jav  a2  s .co m*/
    Assert.assertTrue(body.asMap().size() == 0);
}

From source file:org.openmrs.module.sdmxhdintegration.SDMXHDMessageValidatorTest.java

@Test
@Verifies(value = "should reject if zip file name is empty", method = "validate(Object, Errors)")
public void validate_shouldRejectIfZipFilenameEmpty() {
    SDMXHDMessage message = new SDMXHDMessage();
    message.setName("Test");
    message.setDescription("Description");
    message.setZipFilename("");

    Errors errors = new BindException(message, "message");
    validator.validate(message, errors);
    Assert.assertTrue(errors.hasErrors());
}