Permalink
Browse files

Renamed & rearranged tests for --skip-missing

  • Loading branch information...
1 parent 87405f4 commit 4c60b2de4328f8a1ec5f0ba772afaca1c4334a51 @tivac tivac committed Apr 19, 2011
Showing with 26 additions and 26 deletions.
  1. +26 −26 tests/net/nczonline/web/cssembed/CSSURLEmbedderTest.java
@@ -114,6 +114,32 @@ public void testAbsoluteLocalFileWithSingleQuotes() throws IOException {
assertEquals("background: url(" + folderDataURI + ");", result);
}
+ @Test (expected=IOException.class)
+ public void testAbsoluteLocalFileWithMissingFile() throws IOException {
+ String filename = CSSURLEmbedderTest.class.getResource("folder.png").getPath().replace("%20", " ");
+ String code = "background: url(fooga.png);";
+
+ StringWriter writer = new StringWriter();
+ embedder = new CSSURLEmbedder(new StringReader(code),true);
+ embedder.embedImages(writer, filename.substring(0, filename.lastIndexOf("/")+1));
+
+ String result = writer.toString();
+ assertEquals(code, result);
+ }
+
+ @Test
+ public void testAbsoluteLocalFileWithMissingFilesEnabled() throws IOException {
+ String filename = CSSURLEmbedderTest.class.getResource("folder.png").getPath().replace("%20", " ");
+ String code = "background: url(fooga.png);";
+
+ StringWriter writer = new StringWriter();
+ embedder = new CSSURLEmbedder(new StringReader(code), CSSURLEmbedder.SKIP_MISSING_OPTION, true);
+ embedder.embedImages(writer, filename.substring(0, filename.lastIndexOf("/")+1));
+
+ String result = writer.toString();
+ assertEquals(code, result);
+ }
+
@Test
public void testReadFromAndWriteToSameFile() throws IOException {
String filename = CSSURLEmbedderTest.class.getResource("samefiletest.css").getPath().replace("%20", " ");
@@ -155,30 +181,4 @@ public void testRegularUrlWithMhtml() throws IOException {
"\n--" + CSSURLEmbedder.MHTML_SEPARATOR + "--\n" +
"*/\nbackground: url(folder.txt);", result);
}
-
- @Test (expected=IOException.class)
- public void testRegularUrlwithMissingFile() throws IOException {
- String filename = CSSURLEmbedderTest.class.getResource("folder.png").getPath().replace("%20", " ");
- String code = "background: url(fooga.png);";
-
- StringWriter writer = new StringWriter();
- embedder = new CSSURLEmbedder(new StringReader(code),true);
- embedder.embedImages(writer, filename.substring(0, filename.lastIndexOf("/")+1));
-
- String result = writer.toString();
- assertEquals(code, result);
- }
-
- @Test
- public void testRegularUrlwithMissingFilesEnabled() throws IOException {
- String filename = CSSURLEmbedderTest.class.getResource("folder.png").getPath().replace("%20", " ");
- String code = "background: url(fooga.png);";
-
- StringWriter writer = new StringWriter();
- embedder = new CSSURLEmbedder(new StringReader(code), CSSURLEmbedder.SKIP_MISSING_OPTION, true);
- embedder.embedImages(writer, filename.substring(0, filename.lastIndexOf("/")+1));
-
- String result = writer.toString();
- assertEquals(code, result);
- }
}

0 comments on commit 4c60b2d

Please sign in to comment.