List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:edu.uci.ics.jung.algorithms.generators.random.TestEppsteinPowerLawGenerator.java
public void testSimpleDirectedCase() { for (int r = 0; r < 10; r++) { EppsteinPowerLawGenerator<Integer, Number> generator = new EppsteinPowerLawGenerator<Integer, Number>( graphFactory, vertexFactory, edgeFactory, 10, 40, r); generator.setSeed(2);//from w ww . j a v a 2 s .com Graph<Integer, Number> graph = generator.create(); Assert.assertEquals(graph.getVertexCount(), 10); Assert.assertEquals(graph.getEdgeCount(), 40); } }
From source file:org.jasig.portlet.weather.dao.yahoo.TestYahooWeatherDaoImpl.java
@Test public void test() throws Exception { InputStream is = applicationContext.getResource("classpath:/2502265.xml").getInputStream(); Weather weather = weatherParsingService.parseWeather(is); Assert.assertEquals(weather.getForecast().size(), 2); Assert.assertEquals(weather.getCurrentWeather().getCondition(), "Fair"); }
From source file:org.ocpsoft.rewrite.servlet.config.HttpConfigurationOrder2Test.java
@Test public void testOrder1() throws Exception { HttpAction<HttpGet> action = get("/foobar"); Assert.assertEquals(403, action.getResponse().getStatusLine().getStatusCode()); }
From source file:org.jasig.schedassist.web.owner.schedule.ClearAvailableScheduleFormBackingObjectValidatorTest.java
/** * Test valid inputs, assert no errors./*www. j a v a 2 s .c o m*/ * * @throws Exception */ @Test public void testControl() throws Exception { // first test with "confirmedCancelAll" = cancel the whole schedule ClearAvailableScheduleFormBackingObject fbo = new ClearAvailableScheduleFormBackingObject(); fbo.setConfirmedCancelAll(true); Errors errors = new BindException(fbo, "command"); ClearAvailableScheduleFormBackingObjectValidator validator = new ClearAvailableScheduleFormBackingObjectValidator(); validator.validate(fbo, errors); Assert.assertEquals(0, errors.getAllErrors().size()); // second test with "confirmedCancelWeek" = cancel only 1 specified week fbo = new ClearAvailableScheduleFormBackingObject(); fbo.setConfirmedCancelWeek(true); fbo.setWeekOfPhrase("20090301"); errors = new BindException(fbo, "command"); validator = new ClearAvailableScheduleFormBackingObjectValidator(); validator.validate(fbo, errors); Assert.assertEquals(0, errors.getAllErrors().size()); }
From source file:org.ocpsoft.rewrite.servlet.config.JoinBindingConfigurationTest.java
@Test public void testUrlMappingConfigurationWithoutInboundCorrection() throws Exception { HttpAction<HttpGet> action = get("/bind.html"); Assert.assertEquals(404, action.getResponse().getStatusLine().getStatusCode()); }
From source file:org.ocpsoft.rewrite.servlet.config.ServletMappingConfigurationTest.java
@Test public void testServletMappingConditionDoesNotMatch() throws Exception { HttpAction<HttpGet> action = get("/test-with-unmapped-url"); Assert.assertEquals(210, action.getResponse().getStatusLine().getStatusCode()); }
From source file:com.avego.oauth.migration.OauthDataMigratorTest.java
/** * This tests the data migration with the standard * parameters//w w w .j a v a2 s .c o m * @throws Exception */ public void testDefaultDataMigration() throws Exception { // set system prop to test case System.setProperty(OauthMigrationDaoFactory.MIGRATION_DAO_PROPERTY, InMemTestOauthMigrationDao.class.getName()); OauthDataMigrator migrator = new OauthDataMigrator(null); addTestPrincipalClass(migrator); verifyMigrationOfNoTokens(migrator); InMemTestOauthMigrationDao dao = (InMemTestOauthMigrationDao) migrator.getDao(); initTestTokenData(dao); Assert.assertEquals(1, dao.countUnmigratedAccessTokens()); Assert.assertEquals(1, dao.countUnmigratedRefreshTokens()); Assert.assertEquals(0, dao.countMigratedAccessTokens()); Assert.assertEquals(0, dao.countMigratedRefreshTokens()); migrator.migrateData(); Assert.assertEquals(0, dao.countUnmigratedAccessTokens()); Assert.assertEquals(0, dao.countUnmigratedRefreshTokens()); Assert.assertEquals(1, dao.countMigratedAccessTokens()); Assert.assertEquals(1, dao.countMigratedRefreshTokens()); // check limit Assert.assertEquals(1, dao.getMigratedOauthAccessTokenRecords(1).size()); Assert.assertEquals(1, dao.getMigratedOauthAccessTokenRecords(2).size()); Assert.assertEquals(0, dao.getMigratedOauthAccessTokenRecords(0).size()); Assert.assertEquals(1, dao.getMigratedOauthRefreshTokenRecords(1).size()); Assert.assertEquals(1, dao.getMigratedOauthRefreshTokenRecords(2).size()); Assert.assertEquals(0, dao.getMigratedOauthRefreshTokenRecords(0).size()); }
From source file:com.taobao.ad.jpa.test.UUserTest.java
@Test public void testGetUUserById() { UUserDO uUser = userBO.getUUserById(1L); Assert.assertNotNull(uUser);/*from ww w . j a v a2 s .com*/ Assert.assertEquals("1", uUser.getDescn()); Assert.assertEquals(1, uUser.getId().longValue()); Assert.assertEquals("baimei1@taobao.com", uUser.getEmail()); Assert.assertEquals("136666992031", uUser.getMobile()); Assert.assertEquals("eabd8ce9404507aa8c22714d3f5eada9", uUser.getPassword()); }
From source file:org.ocpsoft.rewrite.servlet.config.JoinOtherwiseConfigurationTest.java
@Test public void testOtherwiseJoinConfiguration() throws Exception { HttpAction<HttpGet> action = get("/p-no/rewrite"); Assert.assertEquals(420, action.getResponse().getStatusLine().getStatusCode()); }
From source file:ar.com.zauber.commons.spring.web.controllers.ExceptionControllerTest.java
/** test */ @Test//from ww w. ja v a 2s .c om public final void test404() throws Exception { req.setAttribute("javax.servlet.error.status_code", 404); final ModelAndView mav = exceptionController.handleRequestInternal(req, res); Assert.assertEquals("exceptions/notfound", mav.getViewName()); }