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.smscserver.test.spring.SpringConfigTest.java

public void test() throws Throwable {
    // FIXME: Hasan variable not expanded
    System.setProperty("SMSC_HOME", "./target/");

    XmlBeanFactory factory = new XmlBeanFactory(
            new FileSystemResource("src/test/resources/spring-config/config-spring-1.xml"));

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

    Assert.assertEquals(500, server.getServerContext().getConnectionConfig().getMaxBinds());
    Assert.assertEquals(124, server.getServerContext().getConnectionConfig().getMaxBindFailures());
    Assert.assertEquals(125, server.getServerContext().getConnectionConfig().getBindFailureDelay());
    Assert.assertEquals(4, server.getServerContext().getConnectionConfig().getMinThreads());
    Assert.assertEquals(16, server.getServerContext().getConnectionConfig().getMaxThreads());
    Assert.assertEquals(2, server.getServerContext().getDeliveryManagerConfig().getManagerThreads());
    Assert.assertEquals(8, server.getServerContext().getDeliveryManagerConfig().getMinThreads());
    Assert.assertEquals(24, server.getServerContext().getDeliveryManagerConfig().getMaxThreads());

    Assert.assertEquals(1000, server.getServerContext().getSessionLockTimeout());

    Map<String, Listener> listeners = server.getServerContext().getListeners();
    Assert.assertEquals(3, listeners.size());

    Listener listener = listeners.get("listener1");
    Assert.assertNotNull(listener);/*from  w w  w. j a v a 2  s .com*/
    Assert.assertTrue(listener instanceof MyCustomListener);
    Assert.assertEquals(2223, listener.getPort());

    listener = listeners.get("listener2");
    Assert.assertNotNull(listener);
    Assert.assertTrue(listener instanceof MyCustomListener);
    Assert.assertEquals(2224, listener.getPort());

    CommandFactory cf = server.getCommandFactory();
    Assert.assertTrue(cf.getCommand(9) instanceof BindCommand);
    Assert.assertTrue(cf.getCommand(21) instanceof EnquireLinkCommand);

    Assert.assertEquals(2, server.getSmsclets().size());
    Assert.assertEquals(123, ((TestSmsclet) server.getSmsclets().get("smsclet1")).getFoo());
    Assert.assertEquals(223, ((TestSmsclet) server.getSmsclets().get("smsclet2")).getFoo());

    Assert.assertNotNull(server.getServerContext().getMessageManager());
}

From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportKeywordDefinitionTest.java

/**
 * @see com.google.api.ads.adwords.awreporting.model.definitions.
 * AbstractReportDefinitionTest#testFirstEntry(
 * com.google.api.ads.adwords.awreporting.model.entities.Report)
 *///from   w  ww  .  j a  va2  s  . c  om
@Override
protected void testFirstEntry(ReportKeyword first) {

    Assert.assertEquals(8661954824L, first.getAccountId().longValue());
    Assert.assertEquals("2013-05-01", first.getDay());
    Assert.assertEquals(0.00, first.getCost().doubleValue());
    Assert.assertEquals(0L, first.getClicks().longValue());
    Assert.assertEquals(20L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(0.00, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(0.00, first.getAvgCpm().doubleValue());
    Assert.assertEquals(0.00, first.getAvgCpc().doubleValue());
    Assert.assertEquals(4.50, first.getAvgPositionBigDecimal().doubleValue());
    Assert.assertEquals("EUR", first.getCurrencyCode());

    Assert.assertEquals(86352677L, first.getCampaignId().longValue());
    Assert.assertEquals(3398915357L, first.getAdGroupId().longValue());
    Assert.assertEquals(41933620L, first.getKeywordId().longValue());
    Assert.assertEquals("enabled", first.getStatus());
    Assert.assertEquals(10.00, first.getQualityScoreAsBigDecimal().doubleValue());
    Assert.assertEquals("Broad", first.getKeywordMatchType());
    Assert.assertEquals("achat fort", first.getKeywordText());
    Assert.assertEquals("", first.getDestinationUrl());
    Assert.assertFalse(first.isNegative());

}

From source file:com.taobao.ad.jpa.test.RepeatAlarmTest.java

@Test
public void testFindReapeatAlerms() {
    RepeatAlarmDO r = new RepeatAlarmDO();
    List<RepeatAlarmDO> rs = repeatAlarmBO.findRepeatAlarms(r);
    Assert.assertNotNull(rs);//from w  w  w  .j  a va2 s  .  c o  m
    Assert.assertEquals(8, rs.size());
}

From source file:io.cloudslang.engine.versioning.services.VersionServiceTest.java

@Test
public void testGetCurrentVersion() throws Exception {
    VersionCounter versionCounter = new VersionCounter("counter1");
    when(versionRepository.findByCounterName("counter1")).thenReturn(versionCounter);

    long result = versionService.getCurrentVersion("counter1");
    Assert.assertEquals(0, result);
}

From source file:ejportal.webapp.action.UserActionTest.java

/**
 * Test cancel./*  ww w  .  j  av a 2  s .  c om*/
 * 
 * @throws Exception
 *             the exception
 */
public void testCancel() throws Exception {
    Assert.assertEquals(this.action.cancel(), "mainMenu");
    Assert.assertFalse(this.action.hasActionErrors());

    this.action.setFrom("list");
    Assert.assertEquals("cancel", this.action.cancel());
}

From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportAdExtensionDefinitionTest.java

/**
 * @see com.google.api.ads.adwords.awreporting.model.definitions.
 * AbstractReportDefinitionTest#testFirstEntry(
 * com.google.api.ads.adwords.awreporting.model.entities.Report)
 */// ww w  .j  a  v  a 2s.c om
@Override
protected void testFirstEntry(ReportAdExtension first) {

    Assert.assertEquals(319387457L, first.getAdExtensionId().longValue());
    Assert.assertEquals(119807057L, first.getCampaignId().longValue());
    Assert.assertEquals("active", first.getStatus());
    Assert.assertEquals("eligible", first.getApprovalStatus());
    Assert.assertEquals("location extension", first.getAdExtensionType());

    Assert.assertEquals("Computers", first.getDevice());
    Assert.assertEquals("Headline", first.getClickType());

    Assert.assertEquals("2013-05-01", first.getDay());
    Assert.assertEquals(0L, first.getClicks().longValue());
    Assert.assertEquals(47L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(0.00, first.getCost().doubleValue());
    Assert.assertEquals(0.00, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(0.00, first.getAvgCpc().doubleValue());
    Assert.assertEquals(0.00, first.getAvgCpm().doubleValue());
    Assert.assertEquals(4.51, first.getAvgPositionBigDecimal().doubleValue());

}

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

@Test
public void testResourceParamForMatchingCondition() throws Exception {
    HttpAction<HttpGet> action = get("/exists.txt");
    Assert.assertEquals(210, action.getResponse().getStatusLine().getStatusCode());
}

From source file:com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.ReportAdGroupDefinitionTest.java

/**
 * @see com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.
 * AbstractReportDefinitionTest#testFirstEntry(
 * com.google.api.ads.adwords.jaxws.extensions.report.model.entities.Report)
 *//*w ww  . ja v a2s .c  o m*/
@Override
protected void testFirstEntry(ReportAdGroup first) {

    Assert.assertEquals(2450945640L, first.getAccountId().longValue());
    Assert.assertEquals("2013-05-07", first.getDay());
    Assert.assertEquals(2.72, first.getCostBigDecimal().doubleValue());
    Assert.assertEquals(6L, first.getClicks().longValue());
    Assert.assertEquals(16L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(37.50, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(170.00, first.getAvgCpmBigDecimal().doubleValue());
    Assert.assertEquals(0.45, first.getAvgCpcBigDecimal().doubleValue());
    Assert.assertEquals(2.69, first.getAvgPositionBigDecimal().doubleValue());
    Assert.assertEquals("EUR", first.getCurrencyCode());
    Assert.assertEquals(129807304L, first.getCampaignId().longValue());
    Assert.assertEquals(7253055064L, first.getAdGroupId().longValue());
    Assert.assertEquals("enabled", first.getStatus());

}

From source file:com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.ReportAccountDefinitionTest.java

/**
 * @see com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.
 * AbstractReportDefinitionTest#testFirstEntry(
 * com.google.api.ads.adwords.jaxws.extensions.report.model.entities.Report)
 *//*from  w w  w  .  j  a v  a  2 s .  c  o  m*/
@Override
protected void testFirstEntry(ReportAccount first) {

    Assert.assertEquals(2602198216L, first.getAccountId().longValue());
    Assert.assertEquals("2013-05-01", first.getDay());
    Assert.assertEquals("Lucotte - Vernoil- Le-fourrier", first.getAccountDescriptiveName());
    Assert.assertEquals(1.42, first.getCostBigDecimal().doubleValue());
    Assert.assertEquals(10L, first.getClicks().longValue());
    Assert.assertEquals(1978L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(0.51, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(0.72, first.getAvgCpmBigDecimal().doubleValue());
    Assert.assertEquals(0.14, first.getAvgCpcBigDecimal().doubleValue());
    Assert.assertEquals(2.97, first.getAvgPositionBigDecimal().doubleValue());
    Assert.assertEquals("EUR", first.getCurrencyCode());
    Assert.assertEquals("Search Network", first.getAdNetwork());
    Assert.assertEquals(17.40, first.getSearchLostISBudgetBigDecimal().doubleValue());
    Assert.assertEquals(42.93, first.getSearchLostISRankBigDecimal().doubleValue());
    Assert.assertEquals(0.0, first.getContentLostISBudgetBigDecimal().doubleValue());
    Assert.assertEquals(0.0, first.getContentLostISRankBigDecimal().doubleValue());
}

From source file:com.collective.celos.AbstractStateDatabaseTest.java

@Test
public void getAndPutWorks() throws Exception {
    StateDatabaseConnection db = getStateDatabaseConnection();
    SlotID slotID = new SlotID(new WorkflowID("foo"), new ScheduledTime("2013-11-27T14:50Z"));
    Assert.assertEquals(null, db.getSlotState(slotID));
    SlotState state = new SlotState(slotID, SlotState.Status.READY);
    db.putSlotState(state);//  www . jav a  2  s. c  o m
    Assert.assertEquals(state, db.getSlotState(slotID));
    Assert.assertEquals(null,
            db.getSlotState(new SlotID(new WorkflowID("bar"), new ScheduledTime("2013-11-27T14:50Z"))));
}