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:ml.shifu.shifu.core.dvarsel.wrapper.WrapperWorkerConductorTest.java

@Test
public void testWrapperConductor() throws IOException {
    ModelConfig modelConfig = CommonUtils.loadModelConfig(
            "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ModelConfig.json",
            RawSourceData.SourceType.LOCAL);
    List<ColumnConfig> columnConfigList = CommonUtils.loadColumnConfigList(
            "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ColumnConfig.json",
            RawSourceData.SourceType.LOCAL);

    WrapperWorkerConductor wrapper = new WrapperWorkerConductor(modelConfig, columnConfigList);
    TrainingDataSet trainingDataSet = genTrainingDataSet(modelConfig, columnConfigList);
    wrapper.retainData(trainingDataSet);

    List<Integer> columnIdList = new ArrayList<Integer>();
    for (int i = 2; i < 30; i++) {
        columnIdList.add(i);//from  ww  w . ja  v a 2  s .co m
    }

    List<CandidateSeed> seedList = new ArrayList<CandidateSeed>();
    for (int i = 0; i < 10; i++) {
        seedList.add(new CandidateSeed(0, columnIdList.subList(i + 1, i + 7)));
    }
    wrapper.consumeMasterResult(new VarSelMasterResult(seedList));
    VarSelWorkerResult workerResult = wrapper.generateVarSelResult();

    Assert.assertNotNull(workerResult);
    Assert.assertTrue(workerResult.getSeedPerfList().size() > 0);
}

From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfigTest.java

@Test
public void testAfterPropertiesSet1() {
    final StaticApplicationContext appContext;
    final AutowiredRemoteServiceGroupConfig config;

    appContext = new StaticApplicationContext();
    appContext.registerSingleton("testService1", TestService1Impl.class);
    appContext.registerSingleton("testService10", TestService10Impl.class);
    appContext.registerSingleton("testService20", TestService20Impl.class);

    config = new AutowiredRemoteServiceGroupConfig();
    config.setBasePackages(Arrays.asList(new String[] { "de.itsvs.cwtrpc.controller.config." }));
    config.setApplicationContext(appContext);
    config.afterPropertiesSet();/* w  w w  .j a  v  a2s. c  o m*/

    Assert.assertTrue(config.getChildGroupConfigs().isEmpty());
    Assert.assertEquals(1, config.getServiceConfigs().size());
    Assert.assertTrue(containsServiceConfig(appContext, config.getServiceConfigs(), TestService1Impl.class));
}

From source file:com.googlecode.t7mp.util.CommonsSetupUtilTest.java

@Test
public void testCopyDirectory() throws IOException {
    File rootDirectory = new File(catalinaBaseDir, "root");
    Assert.assertTrue(rootDirectory.mkdir());
    File.createTempFile("first_", ".tmp", rootDirectory);
    File childDirectory = new File(rootDirectory, "child");
    Assert.assertTrue(childDirectory.mkdir());
    File.createTempFile("second_", ".tmp", childDirectory);
    File webappsDirectory = new File(catalinaBaseDir, "/webapps/");
    webappsDirectory.mkdirs();// w w w .j ava2 s  .c  o m
    File targetDirectory = new File(webappsDirectory, rootDirectory.getName());
    Assert.assertTrue(targetDirectory.mkdirs());

    SetupUtil setupUtil = new CommonsSetupUtil();
    setupUtil.copyDirectory(rootDirectory, targetDirectory);

    File copiedRootDir = new File(webappsDirectory, "/root/");
    Assert.assertTrue(copiedRootDir.isDirectory());
    Assert.assertTrue(copiedRootDir.exists());
    File copiedChildDirectory = new File(copiedRootDir, "/child/");
    Assert.assertTrue(copiedChildDirectory.isDirectory());
    Assert.assertTrue(copiedChildDirectory.exists());
    File[] rootDirectoryFiles = copiedRootDir.listFiles(new FilesOnlyFileFilter());
    Assert.assertEquals(1, rootDirectoryFiles.length);
    Assert.assertTrue(rootDirectoryFiles[0].getName().startsWith("first_"));
    File[] childDirectoryFiles = copiedChildDirectory.listFiles(new FilesOnlyFileFilter());
    Assert.assertEquals(1, childDirectoryFiles.length);
    Assert.assertTrue(childDirectoryFiles[0].getName().startsWith("second_"));
}

From source file:org.ocpsoft.rewrite.gwt.config.HistoryRewriteConfigurationTest.java

@Test
public void testContextPathServedFromCookieOnNormalRequest() throws Exception {
    HttpAction<HttpGet> action = get("/index.html");
    Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode());

    String cookie = action.getResponseHeaderValues("Set-Cookie").get(0);
    Assert.assertTrue(
            cookie.contains("org.ocpsoft.rewrite.gwt.history.contextPath=" + action.getContextPath()));
}

From source file:es.tekniker.framework.ktek.monitoring.mng.server.test.TestMonitoringMngServer.java

@org.junit.Test
public void testGetQuestionnaireList4Status() {
    log.info("*************************************************************");
    log.info("testGetQuestionnaireList4Status: START ");

    MonitoringMngServer manager = new MonitoringMngServer();

    String token = TestData.getLoginToken();

    String result = TestDefines.RESULT_OK;

    int idlang = 1;
    short status = KtekApplicationitemType.STATUSPARAMETERS;
    KtekMonitoringQuestionnaireModelEntityList instance = null;
    String codtelecareprogram = "TBP1";

    try {/*from   w w  w .  j  a  va  2s.c o  m*/
        instance = manager.getQuestionnaireList4TypeMonitoringActivity(token, codtelecareprogram, idlang,
                status);
        if (instance != null) {
            log.info("testGetQuestionnaireList4Status: instance is not null ");
            Assert.assertTrue(true);
        } else {
            log.error("testGetQuestionnaireList4Status: instance is NULL ");
            Assert.assertTrue(false);
            result = TestDefines.RESULT_ERROR;
        }
    } catch (KtekExceptionEntity e) {
        e.printStackTrace();

        log.error("testGetQuestionnaireList4Status: Exception ");
        Assert.assertTrue(false);
        result = TestDefines.RESULT_ERROR;
    }

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

}

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

@Test
public void testSetter() {
    EntityA entity = new EntityA();
    final EntityB entityB = createEntity("Hallo", 2);

    SingleAttribute<EntityB> attribute = (SingleAttribute<EntityB>) getAttribute(PROPERTY);
    Assert.assertNotNull(attribute);//  w  ww  .j  a va2  s. co  m
    attribute.setValue(entity, entityB);
    EntityB value = entity.getEntityB();
    assertEquals(entityB, value);
    Assert.assertTrue(entityB == value);
}

From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceModuleConfigBeanDefinitionParserTest.java

@Test
public void test2() {
    RemoteServiceModuleConfig config;/* w w w.  j av a  2s . c  o  m*/

    config = appContext.getBean("serviceModule102", RemoteServiceModuleConfig.class);
    Assert.assertTrue(config.getResponseCompressionEnabled());
}

From source file:org.openmrs.web.controller.maintenance.SystemInformationControllerTest.java

/**
 * @see SystemInformationController#showPage(ModelMap)
 *//*from w ww  .  j a va  2  s.  c  om*/
@Test
@Verifies(value = "should add database information attribute to the model map", method = "showPage()")
public void showPage_shouldReturnAllDatabaseInformation() {
    Assert.assertTrue(((Map<String, Map<String, String>>) model.get("systemInfo"))
            .containsKey("SystemInfo.title.dataBaseInformation"));
}

From source file:com.nomsic.randb.persistence.xml.RandbXMLPersistenceProviderTest.java

@Test
public void testSave() throws RandbException, FileNotFoundException, IOException {
    String name = "testName";
    provider.save(BlockGroup.generate(name, 2, Arrays.asList(new Integer[] { 2 }),
            Arrays.asList(new String[] { "A", "B" })));

    File file = new File(TEST_DATA_FOLDER + File.separator + "index.xml");
    String indexString = TestUtils.getFileAsString(file);
    Assert.assertTrue(indexString.contains(name));

    String blockGroupFilename = provider.getIndex().getBlockGroupFilename(name);
    file = new File(TEST_DATA_FOLDER + File.separator + blockGroupFilename);
    Assert.assertTrue(file.getAbsolutePath(), file.exists());
    String bgString = TestUtils.getFileAsString(file);
    Assert.assertTrue(bgString.contains(name));
}

From source file:org.openmrs.module.idgen.service.IdentifierSourceServiceTest.java

/**
 * @see {@link IdentifierSourceService#getAllIdentifierSources(boolean)}
 *///from   w  w w . j a  va  2  s  .c  o m
@Test
@Verifies(value = "should return all identifier sources", method = "getAllIdentifierSources(boolean)")
public void getAllIdentifierSources_shouldReturnAllIdentifierSources() throws Exception {
    List<IdentifierSource> sig = iss.getAllIdentifierSources(false);
    Assert.assertTrue(sig.size() == 6);
}