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.ResourceReadParamsInConditionTest.java

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

From source file:com.mirth.connect.plugins.datatypes.dicom.test.DICOMSerializerTest.java

@Test
public void testToXml3() throws Exception {
    String input = Base64/*from   w ww.  ja  va  2s .co m*/
            .encodeBase64String(FileUtils.readFileToByteArray(new File("tests/test-dicom-input-3.dcm")));
    String output = FileUtils.readFileToString(new File("tests/test-dicom-output-3.xml"));
    DICOMSerializer serializer = new DICOMSerializer();
    Assert.assertEquals(output, TestUtil.prettyPrintXml(serializer.toXML(input)));
}

From source file:org.atemsource.atem.impl.pojo.PrimitiveCollectionAssociationAttributeTest.java

@Test
public void testGetCount() {
    EntityType entityType = entityTypeRepository.getEntityType(EntityA.class);
    CollectionAttribute attribute = (CollectionAttribute) entityType.getAttribute("objectList");
    Assert.assertNotNull(attribute);/*from ww w  .  j a  va 2 s  . co  m*/
    EntityA a = new EntityA();
    a.setObjectList(new ArrayList());
    a.getObjectList().add(new Object());
    a.getObjectList().add(new Object());
    Assert.assertEquals(attribute.getSize(a), 2);
}

From source file:com.manning.androidhacks.hack022.login.LoginTest.java

@Test
public void LoginShouldReturnFalseWhenCredentialsAreNotOk() {
    Login login = new Login();
    Assert.assertEquals(false, login.login("user", "wrongPass"));
}

From source file:ma.glasnost.orika.test.converter.PassThroughConverterTestCase.java

@Test
public void testPassThroughConverter() {

    PassThroughConverter ptc = new PassThroughConverter(A.class);

    MapperFactory factory = MappingUtil.getMapperFactory();

    factory.getConverterFactory().registerConverter(ptc);

    A a = new A();
    a.setId(42L);/*from   w  w  w .j  a  va2  s  . co  m*/
    B b = new B();
    b.setString("Hello");
    C c = new C();
    c.setA(a);
    c.setB(b);

    D d = factory.getMapperFacade().map(c, D.class);

    Assert.assertEquals(c.getA(), d.getA());
    Assert.assertEquals(c.getB(), d.getB());
    Assert.assertSame(c.getA(), d.getA());
    Assert.assertNotSame(c.getB(), d.getB());

}

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

/**
 * @see com.google.api.ads.adwords.awreporting.model.definitions.
 * AbstractReportDefinitionTest#testFirstEntry(
 * com.google.api.ads.adwords.awreporting.model.entities.Report)
 *//*from   w  w w .  j  ava 2 s.  c o  m*/
@Override
protected void testFirstEntry(ReportShopping first) {
    Assert.assertEquals("2014-06-20", first.getDay());
    Assert.assertEquals(0.53, first.getCost().doubleValue());
    Assert.assertEquals(2L, first.getClicks().longValue());
    Assert.assertEquals(99L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(2.02, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(0.26, first.getAvgCpc().doubleValue());
    Assert.assertEquals(100514323L, first.getMerchantId().longValue());
    Assert.assertEquals("France", first.getCountryCriteriaId());
    Assert.assertEquals("Maison et jardin", first.getCategoryL1());

    Assert.assertEquals(175572164L, first.getCampaignId().longValue());
    Assert.assertEquals("Shopping", first.getCampaignName());
    Assert.assertEquals(12165252524L, first.getAdGroupId().longValue());
    Assert.assertEquals("Ad Group #1", first.getAdGroupName());
}

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

/**
 * @see com.google.api.ads.adwords.awreporting.model.definitions.
 * AbstractReportDefinitionTest#testFirstEntry(
 * com.google.api.ads.adwords.awreporting.model.entities.Report)
 *///from ww  w .j  av  a2s  .co m
@Override
protected void testFirstEntry(ReportCampaign first) {

    Assert.assertEquals(1232422123L, first.getAccountId().longValue());
    Assert.assertEquals("2013-05-01", first.getDay());
    Assert.assertEquals(1.11, first.getCost().doubleValue());
    Assert.assertEquals(5L, first.getClicks().longValue());
    Assert.assertEquals(927L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(0.54, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(1.20, first.getAvgCpm().doubleValue());
    Assert.assertEquals(0.22, first.getAvgCpc().doubleValue());
    Assert.assertEquals(3.59, first.getAvgPositionBigDecimal().doubleValue());
    Assert.assertEquals("EUR", first.getCurrencyCode());

    Assert.assertEquals(132449648L, first.getCampaignId().longValue());
    Assert.assertEquals("active", first.getStatus());
    Assert.assertEquals(1.00, first.getBudget().doubleValue());
    Assert.assertEquals(41273L, first.getBudgetId().longValue());

}

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

@Override
protected void testFirstEntry(ReportPlaceholderFeedItem first) {
    Assert.assertEquals(128401167L, first.getCampaignId().longValue());
    Assert.assertEquals(7788826047L, first.getAdGroupId().longValue());
    Assert.assertEquals(421887, first.getFeedId().longValue());
    Assert.assertEquals(1785447, first.getFeedItemId().longValue());
    Assert.assertEquals(1, first.getFeedPlaceholderType());
    Assert.assertEquals("Les Ecuries De Kerballan - Gommenech", first.getAccountDescriptiveName());
    Assert.assertEquals(BigDecimalUtil.parseFromNumberString("0.7"),
            BigDecimalUtil.parseFromNumberString(first.getCost()));
    Assert.assertEquals(9, first.getClicks().intValue());
    Assert.assertEquals(74, first.getImpressions().intValue());
    Assert.assertEquals(0, first.getConversions().intValue());
    Assert.assertEquals(BigDecimalUtil.parseFromNumberString("12.16"),
            BigDecimalUtil.parseFromNumberString(first.getCtr()));
    Assert.assertEquals(BigDecimalUtil.parseFromNumberString("9.46"),
            BigDecimalUtil.parseFromNumberString(first.getAvgCpm()));
    Assert.assertEquals(BigDecimalUtil.parseFromNumberString("0.08"),
            BigDecimalUtil.parseFromNumberString(first.getAvgCpc()));
    Assert.assertEquals(BigDecimalUtil.parseFromNumberString("2.2"),
            BigDecimalUtil.parseFromNumberString(first.getAvgPosition()));
    Assert.assertEquals("Headline", first.getClickType());
    Assert.assertEquals("Search Network", first.getAdNetwork());
}

From source file:com.comcast.viper.flume2storm.zookeeper.ZkClientConfigurationTest.java

@Test
public void testFromConfiguration() throws F2SConfigurationException {
    String connectionStr = "host1.whatever.org";
    int sessionTimeout = 1111;
    int connectionTimeout = 2222;
    int reconnectionDelay = 3333;
    int terminationTimeout = 4444;
    Configuration config = new BaseConfiguration();
    config.addProperty(ZkClientConfiguration.CONNECTION_STRING, connectionStr);
    config.addProperty(ZkClientConfiguration.SESSION_TIMEOUT, sessionTimeout);
    config.addProperty(ZkClientConfiguration.CONNECTION_TIMEOUT, connectionTimeout);
    config.addProperty(ZkClientConfiguration.RECONNECTION_DELAY, reconnectionDelay);
    config.addProperty(ZkClientConfiguration.TERMINATION_TIMEOUT, terminationTimeout);

    ZkClientConfiguration zkClientConfiguration = ZkClientConfiguration.from(config);
    Assert.assertEquals(connectionStr, zkClientConfiguration.getConnectionStr());
    Assert.assertEquals(sessionTimeout, zkClientConfiguration.getSessionTimeout());
    Assert.assertEquals(connectionTimeout, zkClientConfiguration.getConnectionTimeout());
    Assert.assertEquals(reconnectionDelay, zkClientConfiguration.getReconnectionDelay());
    Assert.assertEquals(terminationTimeout, zkClientConfiguration.getTerminationTimeout());
}

From source file:com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.ReportAdDefinitionTest.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 w w.j  ava 2  s.  co m*/
@Override
protected void testFirstEntry(ReportAd first) {

    Assert.assertEquals(1001270004L, first.getAccountId().longValue());
    Assert.assertEquals("2013-05-01", first.getDay());
    Assert.assertEquals(9.39, first.getCostBigDecimal().doubleValue());
    Assert.assertEquals(32L, first.getClicks().longValue());
    Assert.assertEquals(1258L, first.getImpressions().longValue());
    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals(2.54, first.getCtrBigDecimal().doubleValue());
    Assert.assertEquals(7.46, first.getAvgCpmBigDecimal().doubleValue());
    Assert.assertEquals(0.29, first.getAvgCpcBigDecimal().doubleValue());
    Assert.assertEquals(2.12, first.getAvgPositionBigDecimal().doubleValue());
    Assert.assertEquals("EUR", first.getCurrencyCode());

    Assert.assertEquals(132958027L, first.getCampaignId().longValue());
    Assert.assertEquals(6113972227L, first.getAdGroupId().longValue());
    Assert.assertEquals(20549800987L, first.getAdId().longValue());
    Assert.assertEquals("enabled", first.getAdState());
    Assert.assertEquals("approved", first.getCreativeApprovalStatus());

}