Example usage for junit.framework Assert assertEquals

List of usage examples for junit.framework Assert assertEquals

Introduction

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

Prototype

static public void assertEquals(int expected, int actual) 

Source Link

Document

Asserts that two ints are equal.

Usage

From source file:org.apache.vysper.xmpp.extension.xep0124.inttests.DefaultAllowedOriginIntegrationTest.java

@Test
public void flashCrossdomain() throws Exception {
    HttpResponse response = httpclient.execute(new HttpGet(getServerUrl() + "crossdomain.xml"));

    Assert.assertEquals(404, response.getStatusLine().getStatusCode());
}

From source file:de.odysseus.staxon.json.stream.jackson.JacksonStreamSourceTest.java

@Test
public void testObjectValue() throws IOException {
    StringReader reader = new StringReader("{\"alice\":\"bob\"}");
    JacksonStreamSource source = new JacksonStreamSource(new JsonFactory().createParser(reader));

    Assert.assertEquals(JsonStreamToken.START_OBJECT, source.peek());
    source.startObject();/*from w ww .  ja v a2 s . co  m*/

    Assert.assertEquals(JsonStreamToken.NAME, source.peek());
    Assert.assertEquals("alice", source.name());

    Assert.assertEquals(JsonStreamToken.VALUE, source.peek());
    Assert.assertEquals("bob", source.value().text);

    Assert.assertEquals(JsonStreamToken.END_OBJECT, source.peek());
    source.endObject();

    Assert.assertEquals(JsonStreamToken.NONE, source.peek());
    source.close();
}

From source file:net.awired.generic.jpa.impl.GenericDaoImplTest.java

@Test
public void should_add_entity() {
    EntityTest entity = new EntityTest();
    entity.setName("genre");
    EntityTest persisted = save(entity);
    Assert.assertEquals("genre", persisted.getName());
    Assert.assertNotNull(persisted.getId());
}

From source file:org.openmrs.module.kenyarx.mapping.ObjectObsMarshallerTest.java

@Test
public void getConceptForClass_shouldReturnConceptIfMappingExists() {
    Concept concept = objectObsMarshaller.getConceptForClass(Dispensing.class);
    Assert.assertEquals(new Integer(1442), concept.getId());
}

From source file:com.collective.celos.ci.testing.fixtures.convert.ConversionCreatorTest.java

@Test
public void testConversionCreatorForFile() throws Exception {
    FixObjectCreator<FixFile> creator = Utils.wrap(new FixFile(IOUtils.toInputStream("lowercase")));
    AbstractFixObjectConverter<FixFile, FixFile> fixObjectConverter = new UpperCaseStringFixFileConverter();
    ConversionCreator<FixFile, FixFile> conversionCreator = new ConversionCreator(creator, fixObjectConverter);

    FixFile result = conversionCreator.create(null);
    Assert.assertEquals("LOWERCASE", IOUtils.toString(result.getContent()));
}

From source file:com.karriem.tp.tddassignment.TDDTestNGTest.java

@Test
public void Object() {

    Assert.assertEquals(service.object(), service);
}

From source file:org.openmrs.module.registrationcore.api.search.ExistingPatientNameSearchTest.java

@Test
public void findSimilarFamilyNames_shouldFindAmongExistingFamilyNames() {
    List<String> names = search.findSimilarFamilyNames("Nar");

    Assert.assertEquals(Arrays.asList("Nari"), names);
}

From source file:org.paxml.selenium.rc.FileServerTest.java

@Test
public void testClasspathResource() throws Exception {

    InputStream inWeb = null;//www.ja va  2 s .  c o m
    InputStream inClass = null;
    final String path = "paxml/dynamic.xml";
    try {

        URL url = new URL(server.hostIt(path, false));

        inWeb = url.openStream();
        inClass = new ClassPathResource(path).getInputStream();

        Assert.assertEquals(IOUtils.readLines(inClass).toString(), IOUtils.readLines(inWeb).toString());

    } finally {
        IOUtils.closeQuietly(inWeb);
        IOUtils.closeQuietly(inClass);
    }
}

From source file:com.netflix.curator.framework.recipes.locks.TestLockCleanlinessWithFaults.java

@Test
public void testNodeDeleted() throws Exception {
    final String PATH = "/foo/bar";

    CuratorFramework client = null;/*from  ww w  . j a v a2 s  .  c  o m*/
    try {
        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryNTimes(0, 0));
        client.start();

        client.create().creatingParentsIfNeeded().forPath(PATH);
        Assert.assertEquals(client.checkExists().forPath(PATH).getNumChildren(), 0);

        LockInternals internals = new LockInternals(client, new StandardLockInternalsDriver(), PATH, "lock-",
                1) {
            @Override
            List<String> getSortedChildren() throws Exception {
                throw new KeeperException.NoNodeException();
            }
        };
        try {
            internals.attemptLock(0, null, null);
            Assert.fail();
        } catch (KeeperException.NoNodeException dummy) {
            // expected
        }

        // make sure no nodes are left lying around
        Assert.assertEquals(client.checkExists().forPath(PATH).getNumChildren(), 0);
    } finally {
        IOUtils.closeQuietly(client);
    }
}

From source file:com.mirth.connect.plugins.datatypes.edi.test.EDISerializerTest.java

@Test
public void testFromXml() throws Exception {
    String input = FileUtils.readFileToString(new File("tests/test-edi-output.xml"));
    String output = FileUtils.readFileToString(new File("tests/test-edi-input.txt"));
    EDISerializer serializer = new EDISerializer(new EDIDataTypeProperties().getSerializerProperties());
    Assert.assertEquals(output, serializer.fromXML(input));
}