List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:piecework.content.concrete.RemoteResourceTest.java
@Test public void verifyLocation() throws MalformedURLException, IOException { Assert.assertEquals(URI_STRING, remoteResource.getLocation()); }
From source file:com.googlecode.ehcache.annotations.integration.ConfigurationFailureTest.java
/** * Test verifies behavior when no {@link Ehcache} is defined for * the cacheName attribute on the {@link Cacheable} annotated method AND * 'createMissingCaches' is false.//from w w w .java2 s . c o m */ @Test public void testNoCache() { try { new ClassPathXmlApplicationContext("/noCacheTestContext.xml"); Assert.fail("Test should have failed with no Cache defined"); } catch (BeanCreationException bce) { Assert.assertEquals("missingCacheNameImpl", bce.getBeanName()); final CacheNotFoundException cnfe = (CacheNotFoundException) bce.getCause(); Assert.assertEquals("nonexistent", cnfe.getCacheName()); } }
From source file:com.mirth.connect.model.converters.tests.HL7SerializerTest.java
@Test public void testToXmlWhitepsace() throws Exception { String input = FileUtils.readFileToString(new File("tests/test-hl7-whitespace-input.txt")); String output = FileUtils.readFileToString(new File("tests/test-hl7-whitespace-output.xml")); ER7Serializer serializer = new ER7Serializer(defaultProperties); Assert.assertEquals(output, TestUtil.prettyPrintXml(serializer.toXML(input))); }
From source file:com.collective.celos.ci.testing.fixtures.convert.ConversionCreatorTest.java
@Test public void testConversionCreatorForDir() throws Exception { FixFile fixFile = new FixFile(IOUtils.toInputStream("lowercase")); Map<String, FixFsObject> map = Maps.newHashMap(); map.put("file", fixFile); FixObjectCreator<FixDir> creator = Utils.wrap(new FixDir(map)); AbstractFixObjectConverter<FixDir, FixDir> fixObjectConverter = new FixDirRecursiveConverter( new UpperCaseStringFixFileConverter()); ConversionCreator<FixDir, FixDir> conversionCreator = new ConversionCreator(creator, fixObjectConverter); FixDir result = conversionCreator.create(null); Assert.assertEquals("LOWERCASE", IOUtils.toString(result.getChildren().get("file").asFile().getContent())); }
From source file:com.logsniffer.model.file.WildcardLogSourceTest.java
@Test public void testLogsResolving() throws IOException { File tmp = File.createTempFile("sdkj", "jk"); tmp.deleteOnExit();//from www .jav a 2 s . c o m File tmpFolder1 = new File(tmp.getPath() + "d", "f1"); tmpFolder1.mkdirs(); tmpFolder1.deleteOnExit(); File tmpFolder2 = new File(tmp.getPath() + "d", "f2"); tmpFolder2.mkdirs(); tmpFolder2.deleteOnExit(); FileUtils.write(new File(tmpFolder1, "1.txt"), "txt"); FileUtils.write(new File(tmpFolder1, "2.txt"), "txt"); FileUtils.write(new File(tmpFolder1, "3.log"), "log"); FileUtils.write(new File(tmpFolder2, "22.txt"), "txt"); File tmpDir = new File(tmpFolder2, "folder.txt"); tmpDir.mkdir(); tmpDir.deleteOnExit(); // Check now WildcardLogsSource source = new WildcardLogsSource(); source.setPattern(tmp.getPath() + "d/*.txt"); Assert.assertEquals(0, source.getLogs().size()); source.setPattern(tmp.getPath() + "d/**/*.txt"); Log[] logs = source.getLogs().toArray(new Log[0]); Assert.assertEquals(3, logs.length); Arrays.sort(logs, new Comparator<Log>() { @Override public int compare(final Log o1, final Log o2) { return o1.getPath().compareTo(o2.getPath()); } }); Assert.assertTrue(logs[0].getPath().endsWith("1.txt")); Assert.assertTrue(logs[1].getPath().endsWith("2.txt")); Assert.assertTrue(logs[2].getPath().endsWith("22.txt")); }
From source file:com.couchbase.lite.BlobStoreTest.java
@Override protected void setUp() throws Exception { super.setUp(); // Create blob store: File storeFile = new File(manager.getDirectory(), "BlobStoreTest"); FileDirUtils.deleteRecursive(storeFile); Assert.assertFalse(storeFile.exists()); if (encrypt)//www .j a v a2s .c o m Log.i(TAG, "---- Now enabling attachment encryption ----"); store = new BlobStore(manager.getContext(), storeFile.getPath(), (encrypt ? new SymmetricKey() : null), true); // If using encryption, the encryption marker must exist: File enMarkerFile = new File(storeFile, BlobStore.ENCRYPTION_MARKER_FILENAME); boolean markerExists = enMarkerFile.exists(); Assert.assertEquals(encrypt, markerExists); }
From source file:org.ocpsoft.rewrite.servlet.validate.BindingValidationTest.java
@Test public void testConfigurationProviderRedirect() throws Exception { HttpAction<HttpGet> action = get("/v/not-v4lid"); Assert.assertEquals(404, action.getResponse().getStatusLine().getStatusCode()); }
From source file:com.facebook.TestUtils.java
public static void assertSamePermissions(final Collection<String> expected, final AccessToken actual) { if (expected == null) { Assert.assertEquals(null, actual.getPermissions()); } else {/* w ww . ja va 2 s . c om*/ for (String p : expected) { Assert.assertTrue(actual.getPermissions().contains(p)); } for (String p : actual.getPermissions()) { Assert.assertTrue(expected.contains(p)); } } }
From source file:org.jboss.spring.quickstarts.kitchensink.kitchensink_spring.test.MemberDaoTest.java
@Test public void testFindByEmail() { Member member = memberDao.findByEmail("john.smith@mailinator.com"); Assert.assertEquals("John Smith", member.getName()); Assert.assertEquals("john.smith@mailinator.com", member.getEmail()); Assert.assertEquals("2125551212", member.getPhoneNumber()); return;// w w w . j ava2 s. c om }
From source file:org.netxilia.spi.impl.format.TestStyleService.java
@Test public void testSet() throws NetxiliaResourceException, NetxiliaBusinessException { Styles style = styleService.applyStyle(new WorkbookId("SYSTEM"), Styles.valueOf("b i"), Styles.valueOf("u s"), StyleApplyMode.set); Assert.assertEquals(Styles.valueOf("u s"), style); style = styleService.applyStyle(new WorkbookId("SYSTEM"), Styles.valueOf("b i"), null, StyleApplyMode.set); Assert.assertNull(style);//from w ww. jav a 2 s . co m }