You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by bo...@apache.org on 2009/02/10 10:53:35 UTC
svn commit: r742920 - in /incubator/rat/main/trunk/rat/rat-anttasks/src/test:
java/org/apache/rat/anttasks/ReportTest.java
resources/antunit/report-junit.xml
Author: bodewig
Date: Tue Feb 10 09:53:30 2009
New Revision: 742920
URL: http://svn.apache.org/viewvc?rev=742920&view=rev
Log:
Make JUnit tests pass on Windows
Modified:
incubator/rat/main/trunk/rat/rat-anttasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
incubator/rat/main/trunk/rat/rat-anttasks/src/test/resources/antunit/report-junit.xml
Modified: incubator/rat/main/trunk/rat/rat-anttasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/rat/rat-anttasks/src/test/java/org/apache/rat/anttasks/ReportTest.java?rev=742920&r1=742919&r2=742920&view=diff
==============================================================================
--- incubator/rat/main/trunk/rat/rat-anttasks/src/test/java/org/apache/rat/anttasks/ReportTest.java (original)
+++ incubator/rat/main/trunk/rat/rat-anttasks/src/test/java/org/apache/rat/anttasks/ReportTest.java Tue Feb 10 09:53:30 2009
@@ -8,61 +8,65 @@
import junit.framework.Assert;
public class ReportTest extends AbstractRatAntTaskTest {
- private static final File antFile = new File("src/test/resources/antunit/report-junit.xml").getAbsoluteFile();
+ private static final File antFile = new File("src/test/resources/antunit/report-junit.xml").getAbsoluteFile();
- protected File getAntFile() {
- return antFile;
- }
-
- public void testWithReportSentToAnt() throws Exception {
- executeTarget("testWithReportSentToAnt");
- assertLogMatches("AL +\\Q" + getAntFile().getPath() + "\\E");
- }
-
- public void testWithReportSentToFile() throws Exception {
- final File reportFile = new File(getTempDir(), "selftest.report");
- getTempDir().mkdirs();
- final String alLine = "AL +\\Q" + getAntFile().getPath() + "\\E";
- if (reportFile.isFile() && !reportFile.delete()) {
- throw new IOException("Unable to remove report file " + reportFile);
- }
- executeTarget("testWithReportSentToFile");
- assertLogDoesntMatch(alLine);
- Assert.assertTrue("Expected report file " + reportFile, reportFile.isFile());
- assertFileMatches(reportFile, alLine);
- }
-
- public void testWithASLUnknown() throws Exception {
- executeTarget("testWithASLUnknown");
- assertLogDoesntMatch("AL +\\Q" + getAntFile().getPath() + "\\E");
- assertLogMatches("\\!\\?\\?\\?\\?\\? +\\Q" + getAntFile().getPath() + "\\E");
- }
-
- public void testCustomMatcher() throws Exception {
- executeTarget("testCustomMatcher");
- assertLogDoesntMatch("AL +\\Q" + getAntFile().getPath() + "\\E");
- assertLogMatches("EXMPL +\\Q" + getAntFile().getPath() + "\\E");
- }
-
- public void testNoResources() throws Exception {
- try {
- executeTarget("testNoResources");
- fail("Expected Exception");
- } catch (BuildException e) {
- final String expect = "You must specify at least one file";
- assertTrue("Expected " + expect + ", got " + e.getMessage(),
- e.getMessage().indexOf(expect) != -1);
- }
- }
-
- public void testNoLicenseMatchers() throws Exception {
- try {
- executeTarget("testNoLicenseMatchers");
- fail("Expected Exception");
- } catch (BuildException e) {
- final String expect = "at least one license";
- assertTrue("Expected " + expect + ", got " + e.getMessage(),
- e.getMessage().indexOf(expect) != -1);
- }
- }
+ protected File getAntFile() {
+ return antFile;
+ }
+
+ public void testWithReportSentToAnt() throws Exception {
+ executeTarget("testWithReportSentToAnt");
+ assertLogMatches("AL +\\Q" + getAntFileName() + "\\E");
+ }
+
+ public void testWithReportSentToFile() throws Exception {
+ final File reportFile = new File(getTempDir(), "selftest.report");
+ getTempDir().mkdirs();
+ final String alLine = "AL +\\Q" + getAntFileName() + "\\E";
+ if (reportFile.isFile() && !reportFile.delete()) {
+ throw new IOException("Unable to remove report file " + reportFile);
+ }
+ executeTarget("testWithReportSentToFile");
+ assertLogDoesntMatch(alLine);
+ Assert.assertTrue("Expected report file " + reportFile, reportFile.isFile());
+ assertFileMatches(reportFile, alLine);
+ }
+
+ public void testWithASLUnknown() throws Exception {
+ executeTarget("testWithASLUnknown");
+ assertLogDoesntMatch("AL +\\Q" + getAntFileName() + "\\E");
+ assertLogMatches("\\!\\?\\?\\?\\?\\? +\\Q" + getAntFileName() + "\\E");
+ }
+
+ public void testCustomMatcher() throws Exception {
+ executeTarget("testCustomMatcher");
+ assertLogDoesntMatch("AL +\\Q" + getAntFileName() + "\\E");
+ assertLogMatches("EXMPL +\\Q" + getAntFileName() + "\\E");
+ }
+
+ public void testNoResources() throws Exception {
+ try {
+ executeTarget("testNoResources");
+ fail("Expected Exception");
+ } catch (BuildException e) {
+ final String expect = "You must specify at least one file";
+ assertTrue("Expected " + expect + ", got " + e.getMessage(),
+ e.getMessage().indexOf(expect) != -1);
+ }
+ }
+
+ public void testNoLicenseMatchers() throws Exception {
+ try {
+ executeTarget("testNoLicenseMatchers");
+ fail("Expected Exception");
+ } catch (BuildException e) {
+ final String expect = "at least one license";
+ assertTrue("Expected " + expect + ", got " + e.getMessage(),
+ e.getMessage().indexOf(expect) != -1);
+ }
+ }
+
+ private String getAntFileName() {
+ return getAntFile().getPath().replace('\\', '/');
+ }
}
Modified: incubator/rat/main/trunk/rat/rat-anttasks/src/test/resources/antunit/report-junit.xml
URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/rat/rat-anttasks/src/test/resources/antunit/report-junit.xml?rev=742920&r1=742919&r2=742920&view=diff
==============================================================================
--- incubator/rat/main/trunk/rat/rat-anttasks/src/test/resources/antunit/report-junit.xml (original)
+++ incubator/rat/main/trunk/rat/rat-anttasks/src/test/resources/antunit/report-junit.xml Tue Feb 10 09:53:30 2009
@@ -64,7 +64,6 @@
<target name="testCustomMatcher">
<mkdir dir="${output.dir}/dest"/>
<mkdir dir="${output.dir}/src/org/example"/>
- <echo file="/tmp/classpath">Classpath is ${test.classpath}</echo>
<typedef name="exmpl" classname="org.example.Matcher"
classpath="${test.classpath}"/>
<typedef name="exmpl-license" classname="org.example.LicenseFamily"
@@ -85,4 +84,4 @@
<file file="${ant.file}"/>
</rat:report>
</target>
-</project>
\ No newline at end of file
+</project>