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.atemsource.atem.impl.common.attribute.AttributeTest.java

protected void assertEquals(final Object o1, final Object o2) {
    Assert.assertTrue(EqualityUtils.isEqual((Serializable) o1, (Serializable) o2));
}

From source file:com.mycompany.capstone.HashtagTest.java

@Test
public void tester() {
    Assert.assertTrue(test != null);

    List<Hashtag> hashtags = hashtagDao.listHashtags();
    Assert.assertTrue(hashtags.size() > 0);

    Hashtag testGet = hashtagDao.getById(test.getId());
    Assert.assertTrue(testGet != null);/*w w w .j av  a  2 s  .c  o  m*/

}

From source file:com.github.neoio.net.message.staging.memory.TestMemoryMessageStaging.java

@Test
public void test_tempRead() {
    ByteBuffer buffer = ByteBuffer.allocate(1024);

    buffer.put("Hello World".getBytes());
    buffer.rewind();//from   w w  w .j a v a 2  s  .  c o m
    staging.writeTempReadBytes(buffer);
    Assert.assertTrue(staging.hasTempReadBytes());

    buffer.clear();
    staging.readTempReadBytes(buffer);
    Assert.assertEquals("Hello World",
            new String(ArrayUtils.subarray(buffer.array(), 0, "Hello World".getBytes().length)));
    staging.resetTempReadBytes();

    Assert.assertFalse(staging.hasTempReadBytes());
}

From source file:com.cloud.agent.dao.impl.PropertiesStorageTest.java

@Test
public void configureWithNotExistingFile() {
    String fileName = "target/notyetexistingfile" + System.currentTimeMillis();
    File file = new File(fileName);

    PropertiesStorage storage = new PropertiesStorage();
    HashMap<String, Object> params = new HashMap<String, Object>();
    params.put("path", fileName);
    Assert.assertTrue(storage.configure("test", params));
    Assert.assertTrue(file.exists());// ww  w  . ja v a 2  s  .  co m
    storage.persist("foo", "bar");
    Assert.assertEquals("bar", storage.get("foo"));

    storage.stop();
    file.delete();
}

From source file:org.apache.bigtop.bigpetstore.qstream.TestLoadGen.java

@org.junit.Test
public void testFileLoadGen() {
    new File("/tmp/transactions0.txt").delete();
    LoadGen.TESTING = true;//from   w ww .  ja va  2 s  . c  o m
    LoadGen.main(new String[] { "/tmp", "1", "5", "1500000", "13241234" });
    Assert.assertTrue(new File("/tmp/transactions0.txt").length() > 0);
}

From source file:org.mayocat.theme.ThemeDefinitionTest.java

@Test
public void testParseTheme() throws Exception {
    String themeConfig = Resources.toString(Resources.getResource("theme.yml"), Charsets.UTF_8);
    ThemeDefinition theme = mapper.readValue(themeConfig, ThemeDefinition.class);

    Assert.assertEquals("Default theme", theme.getName());
    Assert.assertTrue(
            theme.getDescription().startsWith("Et harum quidem rerum facilis est et expedita distinctio."));
    Assert.assertEquals(2, theme.getAddons().size());

    Map<String, AddonGroupDefinition> addons = theme.getAddons();
    Assert.assertEquals(2, addons.keySet().size());

    AddonGroupDefinition group1 = addons.get("group1");
    Assert.assertEquals("Addon group 1", group1.getName());
    Assert.assertEquals("Short help text that is displayed under the addon group", group1.getText());
    List<String> entities = Lists.newArrayList("product", "page");
    Assert.assertEquals(Optional.of(entities), group1.getEntities());
    Map<String, AddonFieldDefinition> fields = group1.getFields();
    AddonFieldDefinition brand = fields.get("brand");
    Assert.assertEquals("Brand", brand.getName());
    Assert.assertEquals("string", brand.getType());

    AddonGroupDefinition group2 = addons.get("group2");
    Map<String, AddonFieldDefinition> fields2 = group2.getFields();
    Assert.assertEquals(2, fields2.keySet().size());
    AddonFieldDefinition field1 = fields2.get("field1");
    Assert.assertEquals("Field 1", field1.getName());
}

From source file:org.duracloud.id.generator.ldap.impl.LdapImplTest.java

@Test
public void testNotInitialize() throws Exception {
    replayMocks();//from   w ww.j  a va2  s .c  o m

    boolean thrown = false;
    try {
        ldap.maxUserId();
        Assert.fail("exception expected");
    } catch (NotInitializedException e) {
        thrown = true;
    }
    Assert.assertTrue(thrown);
}

From source file:com.milaboratory.core.motif.MotifUtilsTest.java

@Test
public void test1() throws Exception {
    RandomGenerator rg = new Well19937c();
    for (int i = 0; i < its(1000, 10000); ++i) {
        int length = 10 + rg.nextInt(30);
        NucleotideSequence seq1 = randomSequence(NucleotideSequence.ALPHABET, length, length);
        NucleotideSequence seq2 = randomSequence(NucleotideSequence.ALPHABET, length, length);
        Motif<NucleotideSequence> motif = MotifUtils.twoSequenceMotif(seq1, 0, seq2, 0, length);
        Assert.assertTrue(motif.matches(seq1, 0));
        Assert.assertTrue(motif.matches(seq2, 0));
    }// www  .j  a v a  2 s. co  m
}

From source file:cc.redberry.core.tensor.random.RandomTensorTest.java

@Test
public void test1() {
    RandomTensor rp = new RandomTensor(4, 10, new int[] { 4, 0, 0, 0 }, new int[] { 10, 0, 0, 0 }, false,
            new Well19937c());
    Tensor t = rp.nextProduct(4, ParserIndices.parseSimple("_nm"));
    Assert.assertTrue(t.getIndices().getFree().equalsRegardlessOrder(ParserIndices.parseSimple("_nm")));
}

From source file:com.googlecode.t7mp.steps.resources.CopySetenvScripStepTest.java

@Before
public void setUp() {
    catalinaBaseDir = Files.createTempDir();
    Assert.assertTrue(catalinaBaseDir.exists());
    Assert.assertNotNull(catalinaBaseDir);
    Assert.assertTrue(catalinaBaseDir.exists());

    Mockito.when(mojo.getCatalinaBase()).thenReturn(catalinaBaseDir);
    Mockito.when(mojo.getLog()).thenReturn(log);
}