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.ocpsoft.rewrite.servlet.config.LifecycleControlTest.java

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

    action = get("/handle");
    Assert.assertEquals(404, action.getStatusCode());
}

From source file:com.rackspacecloud.blueflood.io.serializers.astyanax.CounterRollupSerializationTest.java

@Test
public void testCounterV1RoundTrip() throws IOException {
    BluefloodCounterRollup c0 = new BluefloodCounterRollup().withCount(7442245).withSampleCount(1);
    BluefloodCounterRollup c1 = new BluefloodCounterRollup().withCount(34454722343L).withSampleCount(10);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    baos.write(Base64.encodeBase64(Serializers.counterRollupInstance.toByteBuffer(c0).array()));
    baos.write("\n".getBytes());
    baos.write(Base64.encodeBase64(Serializers.counterRollupInstance.toByteBuffer(c1).array()));
    baos.write("\n".getBytes());

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    BufferedReader reader = new BufferedReader(new InputStreamReader(bais));

    ByteBuffer bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes()));
    BluefloodCounterRollup cc0 = Serializers.serializerFor(BluefloodCounterRollup.class).fromByteBuffer(bb);
    Assert.assertEquals(c0, cc0);

    bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes()));
    BluefloodCounterRollup cc1 = Serializers.serializerFor(BluefloodCounterRollup.class).fromByteBuffer(bb);

    Assert.assertEquals(c1, cc1);//  w  w  w . j  a  v a2  s  .co  m
    Assert.assertFalse(cc0.equals(cc1));
}

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

@Test
public void testUrlMappingConfigurationWithoutInboundCorrection() throws Exception {
    HttpAction<HttpGet> action = get("/invalid_outbound");
    Assert.assertEquals(201, action.getResponse().getStatusLine().getStatusCode());
}

From source file:BQJDBC.QueryResultTest.BQForwardOnlyResultSetFunctionTest.java

@Test
public void ChainedCursorFunctionTest() {
    this.logger.info("ChainedFunctionTest");
    try {//  w  w  w  .j a  va  2s.c o  m
        Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next());
        Assert.assertEquals("you", BQForwardOnlyResultSetFunctionTest.Result.getString(1));

    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }
    try {
        BQForwardOnlyResultSetFunctionTest.Result.absolute(10);
    } catch (SQLException e) {
        Assert.assertTrue(true);
    }

    try {
        for (int i = 0; i < 9; i++) {
            Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next());
        }
        Assert.assertFalse(BQForwardOnlyResultSetFunctionTest.Result.next());
    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }

    try {
        Assert.assertEquals("", BQForwardOnlyResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        Assert.assertTrue(true);
    }

    QueryLoad();
    try {
        Result.next();
        Assert.assertEquals("you", BQForwardOnlyResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }
    this.logger.info("chainedfunctiontest end");
}

From source file:com.dianping.dpsf.centralstat.test.CentralStatTestCase.java

@Test
public void testSyncNormal() {
    CentralStatTestService service = (CentralStatTestService) context.getBean("centralStatTestServiceSync");

    String ret = service.invokeSyncNormal("testSyncNormal");
    Assert.assertEquals("testSyncNormal", ret);
}

From source file:com.couchbase.lite.CollationTest.java

public void testCollateScalars() {
    int mode = kJsonCollator_Unicode;
    Assert.assertEquals(1, SQLiteJsonCollator.testCollate(mode, "true", "false"));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "false", "true"));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "null", "17"));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "1", "1"));
    Assert.assertEquals(1, SQLiteJsonCollator.testCollate(mode, "123", "1"));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "123", "0123.0"));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "123", "\"123\""));
    Assert.assertEquals(1, SQLiteJsonCollator.testCollate(mode, "\"1234\"", "\"123\""));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "\"123\"", "\"1234\""));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "\"1234\"", "\"1235\""));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "\"1234\"", "\"1234\""));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "\"12\\/34\"", "\"12/34\""));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "\"\\/1234\"", "\"/1234\""));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "\"1234\\/\"", "\"1234/\""));
    Assert.assertEquals(0, SQLiteJsonCollator.testCollate(mode, "123",
            "00000000000000000000000000000000000000000000000000123"));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "\"a\"", "\"A\""));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "\"A\"", "\"aa\""));
    Assert.assertEquals(1, SQLiteJsonCollator.testCollate(mode, "\"B\"", "\"aa\""));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "\"~\"", "\"A\""));
    Assert.assertEquals(-1, SQLiteJsonCollator.testCollate(mode, "\"_\"", "\"A\""));
}

From source file:org.ocpsoft.rewrite.faces.DeferredOperationTest.java

@Test
public void testDeferOperationRedirectView() throws Exception {
    HttpAction<HttpGet> action = get("/redirect");
    String content = action.getResponseContent();
    Assert.assertTrue(content == null || content.isEmpty());
    Assert.assertEquals(201, action.getResponse().getStatusLine().getStatusCode());
    Assert.assertEquals("/redirect_result", action.getCurrentContextRelativeURL());
}

From source file:com.collective.celos.ci.testing.fixtures.compare.RecursiveFsObjectComparerTest.java

@Test
public void testSubDirsFail() throws Exception {
    FixDir dir1 = createParentDir1();//  w  w w  .  j a  v a 2 s. com
    FixDir dir2 = createParentDir2();

    FixObjectCompareResult compareResult = new RecursiveFsObjectComparer(Utils.wrap(dir2), Utils.wrap(dir1))
            .check(null);
    Assert.assertEquals(compareResult.getStatus(), FixObjectCompareResult.Status.FAIL);
    String message = "dir2/file2 : File contents differed\n";
    Assert.assertEquals(compareResult.generateDescription(), message);

}

From source file:org.jasig.ssp.util.importer.job.twodottwo.HeaderOnlyTest.java

@SuppressWarnings("unchecked")
@Test//from   w  w w.  j  a  v  a  2s.co m
public void testJob() throws Exception {

    JobExecution jobExecution = jobLauncherTestUtils.launchJob();

    Map<String, ReportEntry> report = (Map<String, ReportEntry>) jobExecution.getExecutionContext()
            .get("report");
    Assert.assertNotNull(report);
    Set<Entry<String, ReportEntry>> entrySet = report.entrySet();
    Assert.assertEquals(1, entrySet.size());
    for (Entry<String, ReportEntry> entry : entrySet) {
        Assert.assertEquals(new Integer(0), entry.getValue().getNumberParsed());
        Assert.assertEquals(new Integer(0), entry.getValue().getNumberSkippedOnParse());
        Assert.assertEquals(new Integer(0), entry.getValue().getNumberSkippedOnDatabaseWrite());
        Assert.assertEquals(new Integer(0), entry.getValue().getNumberInsertedUpdated());
    }
}

From source file:com.collective.celos.ci.testing.fixtures.compare.PlainFileComparerTest.java

@Test
public void testCompareFails() throws Exception {

    InputStream inputStream1 = IOUtils.toInputStream("stream");
    InputStream inputStream2 = IOUtils.toInputStream("stream2");

    FixFile fixFile1 = mock(FixFile.class);
    PlainFileComparer comparer = new PlainFileComparer(inputStream2, fixFile1);

    doReturn(inputStream1).when(fixFile1).getContent();
    FixObjectCompareResult compareResult = comparer.check(null);

    Assert.assertEquals(compareResult.getStatus(), FixObjectCompareResult.Status.FAIL);
}