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:$.DummyDaoImplTest.java

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

From source file:com.github.capone.protocol.crypto.SigningKeyTest.java

@Test
public void signingKeyFromValidSeedSucceeds() throws SigningKey.InvalidSeedException {
    key = SigningKey.fromSeed(StringUtils.repeat("a", SigningKey.BYTES * 2));
    Assert.assertEquals(StringUtils.repeat("a", SigningKey.BYTES * 2), key.toString());
}

From source file:com.chilmers.configbootstrapper.ConfigServletContextListenerTest.java

@Test
public void testDefault() {
    ServletContext contextMock = new MockServletContext();
    ConfigServletContextListener testee = new ConfigServletContextListener();
    testee.contextInitialized(new ServletContextEvent(contextMock));
    Assert.assertEquals("classpath:application.properties", System.getProperty("application.config.location"));
    Assert.assertNotNull(LogManager.exists("com.chilmers.configbootstrapper.test"));
}

From source file:org.apache.wink.test.mock.MockHttpServletRequestWrapperTestCase.java

@Test
public void testContentType() {
    HttpServletRequest req = MockRequestConstructor.constructMockRequest("POST", "/test", "application/json",
            "application/x-www-form-urlencoded", null);
    Assert.assertEquals("application/x-www-form-urlencoded", req.getContentType());
    Assert.assertEquals("application/json", req.getHeader("Accept"));
}

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

@Test
public void testComparesOk() throws Exception {

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

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

    doReturn(inputStream1).when(fixFile1).getContent();
    FixObjectCompareResult compareResult = comparer.check(null);
    Assert.assertEquals(compareResult, FixObjectCompareResult.SUCCESS);
}

From source file:com.pamarin.income.repo.IncomeItemRepoT.java

@Test
public void findMaxItemByOwner() {
    User owner = new User();
    owner.setId(1);//from w  w  w . ja  v  a2 s.co  m
    PageRequest request = new PageRequest(0, 1, Sort.Direction.DESC, "incomeValue");
    Page<Statistic> result = repo.findItemByOwner(owner, request);
    Assert.assertEquals("yyy", result.getContent().get(0).getKey());
}

From source file:eagle.security.userprofile.model.UserProfileKDEModelerTest.java

@org.junit.Test
public void testBuild() throws Exception {
    UserProfileKDEModeler modeler = new UserProfileKDEModeler();
    String user = "user1";
    final RealMatrix mockMatrix = new Array2DRowRealMatrix(buildMockData());
    scala.collection.immutable.List<UserProfileKDEModel> testStatistics = modeler.build("default", user,
            mockMatrix);/*from  ww w .  j av a 2s  . co  m*/
    Assert.assertEquals(testStatistics.length(), 1);
    UserProfileKDEModel model = testStatistics.head();
    Assert.assertEquals(model.user(), "user1");
    Assert.assertEquals(model.statistics().length, mockMatrix.getColumnDimension());
    Assert.assertEquals(-36, model.minProbabilityEstimate(), 1.0);
    Assert.assertEquals(-37, model.maxProbabilityEstimate(), 1.0);
    Assert.assertEquals(-37, model.nintyFivePercentileEstimate(), 1.0);
    Assert.assertEquals(-37, model.medianProbabilityEstimate(), 1.0);
    Assert.assertEquals(true, model.statistics()[3].isLowVariant());
    Assert.assertEquals(false, model.statistics()[0].isLowVariant());
    Assert.assertEquals("setTimes", model.statistics()[3].getCommandName());
    Assert.assertEquals("getfileinfo", model.statistics()[0].getCommandName());
}

From source file:eagle.security.userprofile.model.UserProfileEigenModelerTest.java

@org.junit.Test
public void testBuild() throws Exception {

    UserProfileEigenModeler modeler = new UserProfileEigenModeler();
    String user = "user1";
    final RealMatrix mockMatrix = new Array2DRowRealMatrix(buildMockData());
    List<UserProfileEigenModel> model = modeler.build("default", user, mockMatrix);
    Assert.assertEquals(model.length(), 1);

    UserProfileEigenModel eigenModel = model.head();
    Assert.assertNotNull(eigenModel.statistics());
    Assert.assertNotNull(eigenModel.principalComponents());
    Assert.assertNotNull(eigenModel.maxVector());
    Assert.assertNotNull(eigenModel.minVector());
    Assert.assertEquals(eigenModel.statistics().length, mockMatrix.getColumnDimension());
    Assert.assertTrue(eigenModel.principalComponents().length <= mockMatrix.getColumnDimension());
    Assert.assertTrue(eigenModel.maxVector().getDimension() <= mockMatrix.getColumnDimension());
    Assert.assertTrue(eigenModel.minVector().getDimension() <= mockMatrix.getColumnDimension());
    Assert.assertEquals(true, eigenModel.statistics()[3].isLowVariant());
}

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 ww  .  j av a2  s.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:org.apache.smscserver.test.spring.PropertyPlaceholderTest.java

public void test() throws Throwable {
    System.setProperty("port2", "3333");

    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
            "src/test/resources/spring-config/config-property-placeholder.xml");

    DefaultSmscServer server = (DefaultSmscServer) ctx.getBean("server");

    Assert.assertEquals(2222, server.getServerContext().getListener("listener0").getPort());
    Assert.assertEquals(3333, server.getServerContext().getListener("listener1").getPort());
}