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.atemsource.atem.utility.path.AttributePathImplTest.java

@Test
public void testPrimitive() {
    EntityType<?> entityType = entityTypeRepository.getEntityType(EntityB.class);
    AttributePath path = builderFactory.createAttributePath("integer", entityType);
    EntityB b = new EntityB();
    path.setValue(b, 6);/*from w  w  w  . ja va2s  .  c  o  m*/
    Assert.assertEquals(6, path.getValue(b));
}

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

    Assert.assertEquals("text", first.getAdFormat());
    Assert.assertEquals(5254315098L, first.getAdGroupId().longValue());
    Assert.assertEquals("P:CHN:Zhengzhou:420870", first.getAdGroupName());
    Assert.assertEquals("enabled", first.getAdGroupStatus());
    Assert.assertEquals(108654378L, first.getCampaignId().longValue());
    Assert.assertEquals("P:CHN:MY-ms", first.getCampaignName());
    Assert.assertEquals("active", first.getCampaignStatus());
    Assert.assertEquals(25934427378L, first.getCreativeId().longValue());
    Assert.assertEquals(
            "http://ms.hotels.com/PPCHotelDetails?dateless=true&hotelid=420870&pos=HCOM_MY"
                    + "&locale=ms_MY&rffrid=sem.hcom.MY.google.003.03.02.{ifsearch:s}{ifcontent:c}"
                    + ".kwrd=ZzZz.{ifsearch:s}{ifcontent:c}LT9ZjENe.0.{creative}.10206z418873.d.{device}",
            first.getDestinationUrl());
    Assert.assertEquals(28062339723L, first.getKeywordId().longValue());
    Assert.assertEquals("venus boutique hotel", first.getKeywordTextMatchingQuery());
    Assert.assertEquals("exact", first.getMatchType());
    Assert.assertEquals("venus boutique hotel", first.getQuery());
    Assert.assertEquals("0.00", first.getConversionValue());
    Assert.assertEquals("Google:CHN:PTX", first.getAccountDescriptiveName());
    Assert.assertEquals("(GMT+08:00) Hong Kong", first.getAccountTimeZoneId());
    Assert.assertEquals("USD", first.getCurrencyCode());
    Assert.assertEquals("2014-03-01", first.getDay());
    Assert.assertEquals("0.00", first.getCost());
    Assert.assertEquals(0L, first.getClicks().longValue());
    Assert.assertEquals(1L, first.getImpressions().longValue());
    Assert.assertEquals("0.00", first.getCtr());
    Assert.assertEquals("0.00", first.getAvgCpm());
    Assert.assertEquals("0.00", first.getAvgCpc());
    Assert.assertEquals("7.00", first.getAvgPosition());
    Assert.assertEquals("Tablets with full browsers", first.getDevice());
    Assert.assertEquals("Search Network", first.getAdNetwork());

    Assert.assertEquals(0L, first.getConversions().longValue());
    Assert.assertEquals("0.00", first.getConversionRate());
    Assert.assertEquals("0.00", first.getCostPerConversion());
    Assert.assertEquals("0.00", first.getValuePerConversion());
    Assert.assertEquals(0L, first.getConversionsManyPerClick().longValue());
    Assert.assertEquals("0.00", first.getConversionRateManyPerClick());

    Assert.assertEquals("0.00", first.getCostPerConversionManyPerClick());
    Assert.assertEquals("0.00", first.getValuePerConvManyPerClick());
    Assert.assertEquals(0L, first.getViewThroughConversions().longValue());

}

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

@Test
public void testDeferOperationRestoreView() throws Exception {
    HttpAction<HttpGet> action = get("/empty.xhtml?adf=blah");
    String content = action.getResponseContent();
    Assert.assertTrue(content == null || content.isEmpty());
    Assert.assertEquals(203, action.getResponse().getStatusLine().getStatusCode());
}

From source file:com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.ReportCampaignLocationTargetDefinitionTest.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  .  com*/
@Override
protected void testFirstEntry(ReportCampaignLocationTarget first) {

    Assert.assertEquals(10L, first.getLocationId().longValue());
    Assert.assertEquals("2.00", first.getBidModifier());
    Assert.assertEquals(20L, first.getCampaignId().longValue());
    Assert.assertEquals("campaign", first.getCampaignName());
    Assert.assertEquals("enabled", first.getCampaignStatus());
    Assert.assertEquals("true", first.getIsNegative());
    Assert.assertEquals("2013-10-10", first.getDay());
    Assert.assertEquals(100L, first.getClicks().longValue());
    Assert.assertEquals(500L, first.getImpressions().longValue());
    Assert.assertEquals("1.00", first.getCtr());
    Assert.assertEquals("4.00", first.getAvgCpm());
    Assert.assertEquals("5.00", first.getAvgCpc());
    Assert.assertEquals("6.00", first.getAvgPosition());
    Assert.assertEquals(2L, first.getConversions().longValue());
    Assert.assertEquals("10.00", first.getConversionRate());

}

From source file:org.slc.sli.dashboard.unit.controller.LayoutControllerTest.java

@SuppressWarnings("unchecked")
@Test/*from  www  .  ja v a  2  s  .  co m*/
public void testHandle() throws Exception {
    try {
        ModelAndView mv = layoutController.handle("simpleLayout", null, request);
        Assert.assertEquals(2, ((Map<String, Config>) mv.getModel().get(Constants.MM_KEY_VIEW_CONFIGS)).size());
        Assert.assertEquals(1, ((Map<String, GenericEntity>) mv.getModel().get(Constants.MM_KEY_DATA)).size());
        Assert.assertEquals(1, ((Collection<Config>) mv.getModel().get(Constants.MM_KEY_LAYOUT)).size());
    } catch (Exception e) {
        Assert.fail("Should pass but getting " + e.getMessage());
    }
}

From source file:io.cloudslang.lang.compiler.modeller.transformers.ParallelLoopTransformerTest.java

@Test
public void testValidStatement() throws Exception {
    ListLoopStatement statement = (ListLoopStatement) transformer.transform("x in collection")
            .getTransformedData();//from  w w  w.  j  a va 2 s .co  m
    Assert.assertEquals("x", statement.getVarName());
    Assert.assertEquals("collection", statement.getExpression());
}

From source file:azkaban.crypto.DecryptionTest.java

@Test
public void testV1() throws IOException {
    BasicConfigurator.configure();//from w  w w.j a v a2  s .  c o  m
    Logger.getRootLogger().setLevel(Level.DEBUG);

    String expected = "test";

    String ciphered = "eyJ2ZXIiOiIxLjAiLCJ2YWwiOiJOd1hRejdOMjBXUU05SXEzaE94RVZnPT0ifQ==";
    String passphrase = "test1234";

    Crypto crypto = new Crypto();
    String actual = crypto.decrypt(ciphered, passphrase);
    Assert.assertEquals(expected, actual);

    try {
        new CryptoV1_1().decrypt(ciphered, passphrase);
        Assert.fail("Should have failed when decrypt v1 ciphered text with v1.1 decryption.");
    } catch (Exception e) {
        Assert.assertTrue(e instanceof RuntimeException);
    }
}

From source file:org.ocpsoft.rewrite.servlet.validate.BindingValidationTest.java

@Test
public void testConfigurationIngoresUnconfiguredRequests() throws Exception {
    HttpAction<HttpGet> action = get("/v/bar");
    Assert.assertEquals(206, action.getResponse().getStatusLine().getStatusCode());
}

From source file:org.web4thejob.orm.DataReaderServiceTest.java

@Test
public void findFirstByQuery() {
    final Master1 master1 = ContextUtil.getDRS().get(Master1.class, Long.valueOf(iterations));
    Assert.assertNotNull(master1);/*from  ww  w  . j ava2 s.c om*/

    final Query query = ContextUtil.getEntityFactory().buildQuery(Master1.class);
    query.addOrderBy(new Path(ContextUtil.getMRS().getEntityMetadata(Master1.class).getIdentifierName()), true);

    Assert.assertEquals(master1, ContextUtil.getDRS().findFirstByQuery(query));
}

From source file:net.dahanne.gallery.g2.java.client.utils.G2ConvertUtilsTest.java

@Test
public void g2AlbumToAlbum() throws IOException, JSONException {

    G2Album g2Album = new G2Album();
    g2Album.setId(1024);/*from  ww w .ja  va 2 s. c  o  m*/
    g2Album.setTitle("Title");
    g2Album.setName(12);
    g2Album.setSummary("Summary");
    g2Album.setParentName(1);
    g2Album.setExtrafields("extrafields");

    Album album = G2ConvertUtils.g2AlbumToAlbum(g2Album);

    Album expectedAlbum = new Album();
    expectedAlbum.setId(1024);
    expectedAlbum.setTitle("Title");
    expectedAlbum.setName(12);
    expectedAlbum.setSummary("Summary");
    expectedAlbum.setParentName(1);
    expectedAlbum.setExtrafields("extrafields");

    Assert.assertEquals(expectedAlbum, album);

}