ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45028] New: ant-junit treats ComparisonFailure as Error
Date Sun, 18 May 2008 15:18:21 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45028

           Summary: ant-junit treats ComparisonFailure as Error
           Product: Ant
           Version: 1.7.0
          Platform: PC
               URL: http://xeraph.egloos.com
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: yang@xeraph.com


I tested under JDK 1.6.0_04, JUnit 4.4, Ant 1.7.0

I made a simple junit 4 assert:
assertEquals("t", "test");

I expected ant display the test results as below:
[junit] Tests run: 1, Failures: 1, Errors: 0

but I got:
[junit] Tests run: 1, Failures: 0, Errors: 1

then I add logging code to JUnitTestRunner.java for debugging.
(in src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java)

when string assertEquals fails, junit4 throws org.junit.ComparisonFailure
but ant-junit's JUnitTestRunner uses junit.framework.AssertionFailedError.
In order to correct problem, I had to fix wrapListener method.

In case of other assertEquals fails, junit4 throws java.lang.AssertionError,
so there's no problem at all. I got expected result as below:
assertEquals(1, 2);
[junit] Tests run: 1, Failures: 1, Errors: 0

only ComparisonFailure exception have the problem.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message