Browse Source

Enhance the Bug 38477 tests.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@374689 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 19 years ago
parent
commit
d95378821a
1 changed files with 20 additions and 7 deletions
  1. +20
    -7
      src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java

+ 20
- 7
src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java View File

@@ -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);
}

}

Loading…
Cancel
Save