|
|
@@ -19,6 +19,8 @@ package org.apache.tools.ant.taskdefs.optional.junit; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.net.URL; |
|
|
|
import org.apache.tools.ant.BuildFileTest; |
|
|
|
import org.apache.tools.ant.util.FileUtils; |
|
|
|
|
|
|
@@ -110,15 +112,26 @@ public class JUnitReportTest extends BuildFileTest { |
|
|
|
// Bugzilla Report 38477 |
|
|
|
public void testSpecialSignsInSrcPath() throws Exception { |
|
|
|
executeTarget("testSpecialSignsInSrcPath"); |
|
|
|
if (! new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html").exists()) { |
|
|
|
fail("No index.html present. Not generated?"); |
|
|
|
} |
|
|
|
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html"); |
|
|
|
// tests one the file object |
|
|
|
assertTrue("No index.html present. Not generated?", reportFile.exists() ); |
|
|
|
assertTrue("Cant read the report file.", reportFile.canRead() ); |
|
|
|
assertTrue("File shouldnt be empty.", reportFile.length() > 0 ); |
|
|
|
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report |
|
|
|
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) ); |
|
|
|
InputStream reportStream = reportUrl.openStream(); |
|
|
|
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0); |
|
|
|
} |
|
|
|
public void testSpecialSignsInHtmlPath() throws Exception { |
|
|
|
executeTarget("testSpecialSignsInHtmlPath"); |
|
|
|
if (! new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html# $%§&-!report/index.html").exists()) { |
|
|
|
fail("No index.html present. Not generated?"); |
|
|
|
} |
|
|
|
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html# $%§&-!report/index.html"); |
|
|
|
// tests one the file object |
|
|
|
assertTrue("No index.html present. Not generated?", reportFile.exists() ); |
|
|
|
assertTrue("Cant read the report file.", reportFile.canRead() ); |
|
|
|
assertTrue("File shouldnt be empty.", reportFile.length() > 0 ); |
|
|
|
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report |
|
|
|
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) ); |
|
|
|
InputStream reportStream = reportUrl.openStream(); |
|
|
|
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0); |
|
|
|
} |
|
|
|
|
|
|
|
} |