List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:com.jgoetsch.eventtrader.test.ProfidingMsgParserTest.java
@SuppressWarnings("rawtypes") public void testCommentary() throws Exception { msgParser.parseData("commentary", (Map) JSONValue.parse( "{\"newsletter\":3,\"date\":1344264740426,\"username\":\"timothysykes\",\"image\":\"http://a1.twimg.com/profile_images/1166026278/TimCover1_normal.jpg\",\"msg\":\"Message boards were speculating early in the year about their ability to manufacture iPad tablet screens, I'm gonna listen to conference call now and see if they confirmed it, then this could REALLY run, otherwise probly just gonna sell for a small gain \",\"msgId\":27889}"), new MsgHandler() { public boolean newMsg(Msg msg) { Assert.assertEquals(Msg.class, msg.getClass()); Assert.assertEquals("timothysykes", msg.getSourceName()); Assert.assertEquals("http://a1.twimg.com/profile_images/1166026278/TimCover1_normal.jpg", msg.getImageUrl()); Assert.assertEquals(1344264740426L, msg.getDate().toDate().getTime()); return false; }//ww w . j a v a2s. c om }); // a classic one for sure msgParser.parseData("commentary", (Map) JSONValue.parse( "{\"newsletter\":3,\"date\":1344347965675,\"username\":\"timothysykes\",\"image\":\"http://a1.twimg.com/profile_images/1166026278/TimCover1_normal.jpg\",\"msg\":\"I'm pissed at your laziness and pissed at myself for not following through on my CRMB buy idea int he 2.80s, now 3.50+, what a waste we all are\",\"msgId\":28006}"), new MsgHandler() { public boolean newMsg(Msg msg) { Assert.assertEquals(Msg.class, msg.getClass()); Assert.assertEquals("timothysykes", msg.getSourceName()); Assert.assertEquals(1344347965675L, msg.getDate().toDate().getTime()); Assert.assertTrue( msg.getMessage().startsWith("I'm pissed at your laziness and pissed at myself")); return false; } }); }
From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportCampaignNegativeKeywordDefinitionTest.java
/** * @see com.google.api.ads.adwords.awreporting.model.definitions. * AbstractReportDefinitionTest#testFirstEntry( * com.google.api.ads.adwords.awreporting.model.entities.Report) */// w w w . j a v a2 s . c om @Override protected void testFirstEntry(ReportCampaignNegativeKeyword first) { Assert.assertEquals(11533780L, first.getKeywordId().longValue()); Assert.assertEquals(116981433L, first.getCampaignId().longValue()); Assert.assertEquals("Broad", first.getKeywordMatchType()); Assert.assertEquals("gratuite", first.getKeywordText()); Assert.assertTrue(first.isNegative()); }
From source file:philaman.cput.cardealer.test.service.SpecialistMechanicServiceTest.java
@Test public void mechanicTest() { repo = ctx.getBean(MechanicRepository.class); service = ctx.getBean(SpecialistMechanicService.class); Mechanic m = new Mechanic.Builder("Engine").ratings("intermediate").build(); Mechanic m1 = new Mechanic.Builder("Tyres & Windscreen").ratings("intermediate").build(); Mechanic m2 = new Mechanic.Builder("windscreen & Glass").ratings("intermediate").build(); Mechanic m3 = new Mechanic.Builder("Engine").ratings("Professional").build(); Mechanic m4 = new Mechanic.Builder("Engine").ratings("intermediate").build(); repo.save(m);/*from w ww . ja va 2s . co m*/ /*repo.save(m1); repo.save(m2); repo.save(m3); repo.save(m4);*/ List<Mechanic> specialisMec = service.getSpecialityMechanic("Engine", "intermediate"); Assert.assertEquals(2, specialisMec.size()); }
From source file:org.geomajas.layer.common.proxy.LayerHttpServiceTest.java
@Test public void testAddCredentialsToUrl() throws Exception { LayerHttpServiceImpl service = new LayerHttpServiceImpl(); String base;// w w w . j av a 2s .c o m LayerAuthentication auth = new LayerAuthentication(); auth.setUser("u"); auth.setPassword("p"); base = "noParamYet"; Assert.assertEquals(base, service.addCredentialsToUrl(base, null)); Assert.assertEquals(base, service.addCredentialsToUrl(base, auth)); auth.setAuthenticationMethod(LayerAuthenticationMethod.URL); Assert.assertEquals(base + "?user=u&password=p", service.addCredentialsToUrl(base, auth)); base = "url?bla"; Assert.assertEquals(base + "&user=u&password=p", service.addCredentialsToUrl(base, auth)); auth.setUserKey("who"); auth.setPasswordKey("secret"); Assert.assertEquals(base + "&who=u&secret=p", service.addCredentialsToUrl(base, auth)); }
From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportSearchQueryDefinitionTest.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 a va 2 s .c om*/ @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(0d, first.getCost().doubleValue()); Assert.assertEquals(0L, first.getClicks().longValue()); Assert.assertEquals(1L, first.getImpressions().longValue()); Assert.assertEquals("0.00", first.getCtr()); Assert.assertEquals(0d, first.getAvgCpm().doubleValue()); Assert.assertEquals(0d, first.getAvgCpc().doubleValue()); 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(0d, first.getCostPerConversion().doubleValue()); Assert.assertEquals("0.00", first.getValuePerConversion()); Assert.assertEquals(0L, first.getConversionsManyPerClick().longValue()); Assert.assertEquals("0.00", first.getConversionRateManyPerClick()); Assert.assertEquals(0d, first.getCostPerConversionManyPerClick().doubleValue()); Assert.assertEquals("0.00", first.getValuePerConvManyPerClick()); Assert.assertEquals(0L, first.getViewThroughConversions().longValue()); }
From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportCampaignLocationTargetDefinitionTest.java
/** * @see com.google.api.ads.adwords.awreporting.model.definitions. * AbstractReportDefinitionTest#testFirstEntry(com.google.api.ads.adwords.awreporting.model.entities.Report) *//*w w w. ja v a 2s. c o m*/ @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().doubleValue()); Assert.assertEquals(5.00, first.getAvgCpc().doubleValue()); Assert.assertEquals("6.00", first.getAvgPosition()); Assert.assertEquals(2L, first.getConversions().longValue()); Assert.assertEquals("10.00", first.getConversionRate()); }
From source file:com.collective.celos.ci.testing.fixtures.convert.FixTableToTSVFileConverterTest.java
@Test public void testFixTableToJsonFileConverter() throws Exception { FixTableToTSVFileConverter converter = new FixTableToTSVFileConverter(); List<FixTable.FixRow> fixRows = Lists.newArrayList(); Map<String, String> map = Maps.newHashMap(); map.put("col1", "val1"); map.put("col2", "val2"); Map<String, String> map2 = Maps.newHashMap(); map2.put("col1", "val11"); map2.put("col2", "val22"); FixTable.FixRow row1 = new FixTable.FixRow(map); FixTable.FixRow row2 = new FixTable.FixRow(map2); fixRows.add(row1);/*w ww .j a va 2 s. c o m*/ fixRows.add(row2); FixTable fixTable = new FixTable(Lists.newArrayList("col1", "col2"), fixRows); FixFile fixFile = converter.convert(null, fixTable); String tableStr = IOUtils.toString(fixFile.getContent()); String expectedStr = "val1\tval2\n" + "val11\tval22\n"; Assert.assertEquals(expectedStr, tableStr); }
From source file:com.google.api.ads.adwords.jaxws.extensions.report.model.definitions.ReportDestinationUrlDefinitionTest.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) *//*ww w . j a v a 2s .c om*/ @Override protected void testFirstEntry(ReportDestinationUrl row) { Assert.assertEquals("(GMT+01:00) Paris", row.getAccountTimeZoneId()); Assert.assertEquals(3448007340L, row.getAdGroupId().longValue()); Assert.assertEquals("Ad Group #1", row.getAdGroupName()); Assert.assertEquals("enabled", row.getAdGroupStatus()); Assert.assertEquals(84058260L, row.getCampaignId().longValue()); Assert.assertEquals("CAMPAGNE", row.getCampaignName()); Assert.assertEquals("active", row.getCampaignStatus()); //Assert.assertEquals("0.00", row.getConversionRate()); //Assert.assertEquals("0.00", row.getConversionRateManyPerClick()); Assert.assertEquals(0L, row.getConversionsManyPerClick().longValue()); //Assert.assertEquals(null, row.getConversionValue()); //Assert.assertEquals("0.00", row.getCostPerConversion()); //Assert.assertEquals("0.00", row.getCostPerConversionManyPerClick()); Assert.assertEquals("", row.getCriteriaDestinationUrl()); Assert.assertEquals("+immo +benodet", row.getCriteriaParameters()); Assert.assertEquals("enabled", row.getCriteriaStatus()); Assert.assertEquals("Broad", row.getCriteriaTypeName()); Assert.assertEquals("Era Rouxelimmo - Plomelin", row.getCustomerDescriptiveName()); Assert.assertEquals("Sunday", row.getDayOfWeek()); Assert.assertEquals("http://www.era-immobilier-plomelin.fr", row.getEffectiveDestinationUrl()); Assert.assertEquals("false", row.getIsNegative()); Assert.assertEquals("September", row.getMonthOfYear()); Assert.assertEquals("", row.getPrimaryCompanyName()); Assert.assertEquals("", row.getPrimaryUserLogin()); Assert.assertEquals("2013-07-01", row.getQuarter()); }
From source file:org.ocpsoft.rewrite.servlet.config.JoinRequestBindingConfigurationTest.java
@Test public void testWithoutRequestBinding() throws Exception { HttpAction<HttpGet> action = get("/norb/value"); Assert.assertEquals(202, action.getResponse().getStatusLine().getStatusCode()); }
From source file:org.jasig.ssp.util.importer.job.PrototypeJobRunnerTest.java
@Test public void testJob() throws Exception { logger.info(System.getProperty("batch.tables.upsert.files")); BatchStatus jobExecution = jobLauncherTestUtils.launchJob().getStatus(); Assert.assertEquals(BatchStatus.COMPLETED, jobExecution); }