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:com.github.neoio.net.message.staging.file.TestFileMessageStaging.java

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

    buffer.put("Hello World".getBytes());
    buffer.flip();//from   w  w  w  .j a  v  a 2s  .  c om
    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:io.cloudslang.lang.runtime.navigations.NavigationsTest.java

@Test
public void simpleNavigateTest() throws Exception {

    RunEnvironment runEnv = new RunEnvironment();
    Long nextStepId = 2L;//  w w w  . j  a v a 2 s. c om
    runEnv.putNextStepPosition(nextStepId);
    Long nextPosition = navigations.navigate(runEnv, new ExecutionRuntimeServices());

    Assert.assertEquals(nextStepId, nextPosition);
}

From source file:com.metamx.emitter.core.LoggingEmitterConfigTest.java

@Test
public void testSettingEverything() {
    final Properties props = new Properties();
    props.setProperty("com.metamx.emitter.logging.class", "Foo");
    props.setProperty("com.metamx.emitter.logging.level", "INFO");

    final ObjectMapper objectMapper = new ObjectMapper();
    final LoggingEmitterConfig config = objectMapper.convertValue(Emitters.makeLoggingMap(props),
            LoggingEmitterConfig.class);

    Assert.assertEquals("Foo", config.getLoggerClass());
    Assert.assertEquals("INFO", config.getLogLevel());
}

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

@Test
public void testArrayValue() throws IOException {
    StringWriter writer = new StringWriter();
    JacksonStreamTarget target = new JacksonStreamTarget(new JsonFactory().createGenerator(writer));

    target.startArray();/*from w  w w  . j  a  v a2  s.  c o  m*/
    target.value("bob");
    target.endArray();

    target.close();

    Assert.assertEquals("[\"bob\"]", writer.toString());
}

From source file:$.DummyDaoImplTest.java

@Test
    public void update() {
        Dummy d = new Dummy();
        d.setName("dummy");
        dummyDao.create(d);/*from   w w w.j av  a 2 s  .c  o m*/
        d.setName("otherDummy");
        dummyDao.update(d);
        Assert.assertEquals("otherDummy", dummyDao.find(d.getId()).getName());
    }

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

@Test
public void testRequestBinding() throws Exception {
    HttpAction<HttpGet> action = get("/requestBinding/ONE/TWO");
    Assert.assertEquals(210, action.getResponse().getStatusLine().getStatusCode());

    Assert.assertEquals("ONE", action.getResponseHeaderValues("one").get(0));
    Assert.assertEquals("TWO", action.getResponseHeaderValues("two").get(0));
}

From source file:org.urbantower.j4s.example.autowired.AutowiredHandlersTest.java

@Test
public void isJettyServerRunning() throws InterruptedException, IOException {
    HttpGet request = new HttpGet("http://localhost:9093/test/servlet");
    CloseableHttpResponse response = httpclient.execute(request);
    String body = EntityUtils.toString(response.getEntity());
    Assert.assertEquals(body, "Hello Servlet");
}

From source file:ar.com.zauber.commons.xmpp.message.XMPPMessageTest.java

/** message */
@Test//www.j  a v  a 2s  .co m
public final void testSimple() throws Exception {
    final XMPPMessage c = new XMPPMessage("body", "title");
    org.jivesoftware.smack.packet.Message m = c.getXMPPMessage("juan");
    m.setPacketID("0");
    Assert.assertEquals(getResult("simple-normal.xml"), m.toXML());
}

From source file:core.service.test.proxy.TestServiceProxy.java

@Test
public void testInvoke() {

    MathService proxy = (MathService) ServiceProxy.newInstance(MathService.class, context);
    Integer sum = proxy.add(2, 2);

    Assert.assertEquals(new Integer(4), sum);
}

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

@Test
public void testAbort() throws Exception {
    HttpAction<HttpGet> action = get("/aborty");
    Assert.assertEquals(400, action.getStatusCode());

    action = get("/abort");
    Assert.assertEquals(200, action.getStatusCode());
}