List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:org.ocpsoft.rewrite.faces.PhaseOperationTest.java
@Test public void testDeferOperationRenderResponse() throws Exception { HttpAction<HttpGet> action = get("/render_response"); String content = action.getResponseContent(); Assert.assertTrue(content == null || content.isEmpty()); Assert.assertEquals(204, action.getResponse().getStatusLine().getStatusCode()); }
From source file:org.jasig.portlet.weather.dao.yahoo.TestYahooWeatherDaoImpl.java
@Test public void testSearch() throws Exception { InputStream is = applicationContext.getResource("classpath:/yahooLondonSearch.xml").getInputStream(); List<Location> locations = locationParsingService.parseLocations(is); Assert.assertEquals(locations.size(), 10); }
From source file:org.ocpsoft.rewrite.servlet.config.ResourceTest.java
@Test public void testResourceParamReadsForMissingParameter() throws Exception { HttpAction<HttpGet> action = get("/file.bah"); Assert.assertEquals(211, action.getResponse().getStatusLine().getStatusCode()); }
From source file:net.roboconf.dm.rest.commons.json.JSonBindingUtilsTest.java
@Test public void testApplicationBinding_1() throws Exception { final String result = "{\"name\":\"app1\",\"desc\":\"some text\",\"qualifier\":\"v1\"}"; ObjectMapper mapper = JSonBindingUtils.createObjectMapper(); Application app = new Application("app1").description("some text").qualifier("v1"); StringWriter writer = new StringWriter(); mapper.writeValue(writer, app);//from w w w.ja v a 2 s.c o m String s = writer.toString(); Assert.assertEquals(result, s); Application readApp = mapper.readValue(result, Application.class); Assert.assertEquals(app, readApp); Assert.assertEquals(app.getName(), readApp.getName()); Assert.assertEquals(app.getDescription(), readApp.getDescription()); Assert.assertEquals(app.getQualifier(), readApp.getQualifier()); }
From source file:fr.mailjet.event.JsonParameterTest.java
@Test(timeout = 10000L) public void open() throws IOException { OpenMailjetEvent event = new OpenMailjetEvent("open", 1344859910L, "olivier.pitton@gmail.com", "390319834", "241755226", "custom", "82.229.159.100", "FR", "Mozilla\5.0 (X11; Linux x86_64) AppleWebKit\537.1 (KHTML, like Gecko) Chrome\21.0.1180.75 Safari\537.1"); JsonNode node = toNode(event);/* ww w.j a v a2 s. co m*/ checkAMailjetEvent(event, node); checkACampaignEvent(event, node); Assert.assertEquals(getString(node, "ip"), event.getIp()); Assert.assertEquals(getString(node, "geo"), event.getGeo()); Assert.assertEquals(getString(node, "agent"), event.getAgent()); }
From source file:net.padaf.xmpbox.parser.XMLPropertiesDescriptionManagerTest.java
@Test public void testPropDesc() throws Exception { List<String> propNames = new ArrayList<String>(); propNames.add("propName1"); propNames.add("propName2"); List<String> descProps = new ArrayList<String>(); descProps.add("descProp1"); descProps.add("descProp2"); XMLPropertiesDescriptionManager xmlParser = new XMLPropertiesDescriptionManager(); xmlParser.addPropertyDescription(propNames.get(0), descProps.get(0)); xmlParser.addPropertyDescription(propNames.get(1), descProps.get(1)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); xmlParser.toXML(bos);//w ww .ja va 2 s .co m IOUtils.closeQuietly(bos); XMLPropertiesDescriptionManager propRetrieve = new XMLPropertiesDescriptionManager(); InputStream is = new ByteArrayInputStream(bos.toByteArray()); propRetrieve.loadListFromXML(is); List<PropertyDescription> propList = propRetrieve.getPropertiesDescriptionList(); Assert.assertEquals(propNames.size(), propList.size()); for (int i = 0; i < propList.size(); i++) { Assert.assertTrue(propNames.contains(propList.get(i).getPropertyName())); Assert.assertTrue(descProps.contains(propList.get(i).getDescription())); } }
From source file:com.sap.prd.mobile.ios.mios.VersionInfoManagerTest.java
@Test public void testOldVersionInfoFormatAlpha20() throws Exception { List<Dependency> dependencies = new ArrayList<Dependency>(); dependencies//from www . j a v a 2s . c om .add(VersionInfoXmlManager.parseDependency(new File("src/test/resources/versions-alpha-20.xml"))); final ByteArrayOutputStream os = new ByteArrayOutputStream(); try { new VersionInfoXmlManager().createVersionInfoFile("com.sap.ondevice.production.ios.tests", "MyApp", "1.0.0", new File(".", "src/test/resources/sync.info"), dependencies, os); Assert.assertEquals(IOUtil.toString( new FileInputStream( new File("src/test/resources/versionInfoFileRewritten-alpha-20.xml").getAbsoluteFile()), "UTF-8"), IOUtil.toString(os.toByteArray(), "UTF-8")); } finally { IOUtils.closeQuietly(os); } }
From source file:com.collective.celos.ci.testing.tree.TreeStructureProcessorTest.java
@Test public void testTreeStructureProcessor() throws IOException { FixDir dir1 = createDirWithSubdirsAndFile(); InputStream inputStream2 = IOUtils.toInputStream("stream3"); FixFile file = new FixFile(inputStream2); Map<String, FixFsObject> content = Maps.newHashMap(); content.put("dir1", dir1); content.put("file", file); FixDir dir = new FixDir(content); TreeObjectProcessorImpl holder = new TreeObjectProcessorImpl(); TreeObjectProcessor.process(dir, holder); List<Path> expectedStructure = Lists.newArrayList(Paths.get(""), Paths.get("file"), Paths.get("dir1"), Paths.get("dir1/file"), Paths.get("dir1/dir1"), Paths.get("dir1/dir1/file1"), Paths.get("dir1/dir1/file2"), Paths.get("dir1/dir2"), Paths.get("dir1/dir2/file1"), Paths.get("dir1/dir2/file2")); Collections.sort(expectedStructure); Collections.sort(holder.content); Assert.assertEquals(holder.content, expectedStructure); }
From source file:org.ocpsoft.rewrite.gwt.config.HistoryRewriteConfigurationTest.java
@Test public void testContextPathNotServedFromGetRequest() throws Exception { HttpAction<HttpGet> action = get("/index.html?org.ocpsoft.rewrite.gwt.history.contextPath"); Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode()); Assert.assertTrue(action.getResponseHeaderValues("org.ocpsoft.rewrite.gwt.history.contextPath").isEmpty()); }
From source file:org.openmrs.event.EventTest.java
/** * @see {@link Event#subscribe(Class<OpenmrsObject>,String,EventListener)} *///from www.ja v a2s.c om @Test @NotTransactional @Verifies(value = "should subscribe only to the specified action", method = "subscribe(Class<OpenmrsObject>,String,EventListener)") public void subscribe_shouldSubscribeOnlyToTheSpecifiedAction() throws Exception { ConceptService cs = Context.getConceptService(); MockEventListener listener = new MockEventListener(3); //let's wait for 3 messages Event.subscribe(Concept.class, Action.UPDATED.toString(), listener); Concept concept = new Concept(); ConceptName name = new ConceptName("Name", Locale.ENGLISH); concept.addName(name); cs.saveConcept(concept); concept.setVersion("new random version"); cs.saveConcept(concept); cs.purgeConcept(concept); listener.waitForEvents(); Assert.assertEquals(0, listener.getCreatedCount()); Assert.assertEquals(1, listener.getUpdatedCount()); Assert.assertEquals(0, listener.getDeletedCount()); }