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.googlecode.t7mp.steps.resources.CopySetenvScripStepTest.java

@Test
public void testCopySetenvScriptStep() {
    String setenvScriptPath = getClass().getResource("/com/googlecode/t7mp/bin/setenv.sh").getPath();
    File t7mpDirectory = new File(setenvScriptPath).getParentFile().getParentFile();
    File confDirectory = new File(t7mpDirectory, "/conf/");
    Assert.assertNotNull(confDirectory);
    Assert.assertTrue(confDirectory.exists());
    Mockito.when(mojo.getTomcatConfigDirectory()).thenReturn(new File(t7mpDirectory, "/conf/"));
    Context context = new DefaultContext(mojo);
    Step step = new CopySetenvScriptStep();
    step.execute(context);/*from  w w w . j  av  a2 s . co  m*/
    File binDirectory = new File(catalinaBaseDir, "/bin/");
    Assert.assertNotNull(binDirectory);
    Assert.assertTrue(binDirectory.exists());
    File copyiedSetenvScript = new File(binDirectory, "setenv.sh");

    Assert.assertNotNull(copyiedSetenvScript);
    Assert.assertTrue(copyiedSetenvScript.exists());
}

From source file:com.sludev.commons.vfs2.provider.azure.AzTestUtils.java

public static void deleteFile(String accntName, String accntHost, String accntKey, String containerName,
        Path remotePath) throws FileSystemException {
    DefaultFileSystemManager currMan = new DefaultFileSystemManager();
    currMan.addProvider(AzConstants.AZSBSCHEME, new AzFileProvider());
    currMan.init();/*  ww  w  .  j a v a 2s . co m*/

    StaticUserAuthenticator auth = new StaticUserAuthenticator("", accntName, accntKey);
    FileSystemOptions opts = new FileSystemOptions();
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);

    String currUriStr = String.format("%s://%s/%s/%s", AzConstants.AZSBSCHEME, accntHost, containerName,
            remotePath);
    FileObject currFile = currMan.resolveFile(currUriStr, opts);

    Boolean delRes = currFile.delete();
    Assert.assertTrue(delRes);
}

From source file:it.guru.nidi.atlassian.remote.jira.JiraRestServiceTest.java

@Test
public void testRestGetVersions() throws IOException, RestException {
    RemoteVersion[] versions = js.getVersions("TST");
    Assert.assertTrue(versions.length > 0);
}

From source file:azkaban.app.AzkabanApplicationTest.java

@Test
public void testAddJobAndReload() throws Exception {
    String testJob = "testjob";
    AzkabanApplication app = new AzkabanApplication(Arrays.asList(jobDir), logDir, tmpDir, false);
    Assert.assertEquals(0, app.getJobManager().loadJobDescriptors().size());
    Assert.assertNull(app.getJobManager().getJobDescriptor(testJob));

    File newJobDir = new File(jobDir, "test");
    FileUtils.forceMkdir(newJobDir);//w  ww  .j a  v a 2 s . c o  m
    File newJob = new File(newJobDir, testJob + ".job");
    FileUtils.writeLines(newJob, Arrays.asList("type=command", "command=ls"));

    app.reloadJobsFromDisk();

    Assert.assertEquals(1, app.getJobManager().loadJobDescriptors().size());
    Job loadedJob = app.getJobManager().loadJob(testJob, true);

    Assert.assertEquals(testJob, loadedJob.getId());
    Assert.assertTrue(loadedJob instanceof LoggingJob);
    Assert.assertTrue(((LoggingJob) loadedJob).getInnerJob() instanceof ProcessJob);
}

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

@Test
public void test1() {
    RemoteServiceControllerConfig config;

    config = appContext.getBean("serviceController100", RemoteServiceControllerConfig.class);
    Assert.assertEquals(1, config.getServiceModuleConfigs().size());
    Assert.assertEquals("myModule700", config.getServiceModuleConfigs().iterator().next().getName());
    Assert.assertTrue(config.getResponseCompressionEnabled());
    Assert.assertFalse(config.getRpcTokenProtectionEnabled());
    Assert.assertEquals("rpcTokenService", config.getRpcTokenValidatorName());
    Assert.assertSame(appContext.getBean("serializationPolicyProvider"),
            config.getSerializationPolicyProvider());
}

From source file:eu.stratosphere.pact.runtime.task.TempTaskTest.java

@Test
public void testTempTask() {
    int keyCnt = 1024;
    int valCnt = 4;

    super.initEnvironment(1024 * 1024 * 1);
    super.addInput(new UniformPactRecordGenerator(keyCnt, valCnt, false), 1);
    super.addOutput(this.outList);

    TempTask<PactRecord> testTask = new TempTask<PactRecord>();
    super.getTaskConfig().setMemorySize(1 * 1024 * 1024);

    super.registerTask(testTask, PrevStub.class);

    try {/*from  w w w  . j av a  2 s.c om*/
        testTask.invoke();
    } catch (Exception e) {
        LOG.debug(e);
        Assert.fail("Invoke method caused exception.");
    }

    Assert.assertTrue(this.outList.size() == keyCnt * valCnt);

}

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

@Test
public void testContextPathNotServedFromGetRequest() throws Exception {
    HttpAction<HttpGet> action = get("/index.html?org.ocpsoft.rewrite.gwt.history.contextPath");
    Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode());

    Assert.assertTrue(action.getResponseHeaderValues("org.ocpsoft.rewrite.gwt.history.contextPath").isEmpty());
}

From source file:im.tym.wraop.both.SpringAOPWrapperFactorySpiTest.java

@Test
public void testAdvice() {
    Assert.assertTrue(factory.addAspect(new TrimTransformerAdvice()));
    Transformer<Object, String> transformer = factory.wrap(new ToStringTransformer(),
            this.getClass().getClassLoader());
    Assert.assertEquals("test", transformer.transform(" test "));
}

From source file:com.brienwheeler.lib.test.stepper.SteppableThreadTest.java

@Test
public void testSteppedInterruptFlag() {
    SteppableThread stepper = new SteppableSetInterruptAndThrow();
    stepper.start();//from   w  w w  .  j  ava 2s .  com
    stepper.releaseAndJoin();
    Assert.assertTrue(stepper.getWasInterrupted());
}

From source file:net.padaf.xmpbox.parser.XMLPropertiesDescriptionManagerTest.java

@Test
public void testPropDesc() throws Exception {
    List<String> propNames = new ArrayList<String>();
    propNames.add("propName1");
    propNames.add("propName2");
    List<String> descProps = new ArrayList<String>();
    descProps.add("descProp1");
    descProps.add("descProp2");

    XMLPropertiesDescriptionManager xmlParser = new XMLPropertiesDescriptionManager();

    xmlParser.addPropertyDescription(propNames.get(0), descProps.get(0));
    xmlParser.addPropertyDescription(propNames.get(1), descProps.get(1));

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    xmlParser.toXML(bos);/*from   www  .  java  2 s.  c om*/
    IOUtils.closeQuietly(bos);

    XMLPropertiesDescriptionManager propRetrieve = new XMLPropertiesDescriptionManager();

    InputStream is = new ByteArrayInputStream(bos.toByteArray());
    propRetrieve.loadListFromXML(is);

    List<PropertyDescription> propList = propRetrieve.getPropertiesDescriptionList();
    Assert.assertEquals(propNames.size(), propList.size());
    for (int i = 0; i < propList.size(); i++) {
        Assert.assertTrue(propNames.contains(propList.get(i).getPropertyName()));
        Assert.assertTrue(descProps.contains(propList.get(i).getDescription()));
    }

}