Community
Participate
Working Groups
Build ID: M20071023-1652 Steps To Reproduce: Use the following test class: import junit.framework.Assert; import org.junit.Test; public class DummyTest { @Test public void passingTest() throws Exception { Assert.assertEquals( "expected", "expected" ); } @Test public void failingTest() throws Exception { Assert.assertEquals( "expected", "actual" ); } } Run As->Junit test and you get the following stack trace (in the console - not in the JUnit view): java.lang.NoSuchMethodError: junit.framework.ComparisonFailure.getExpected()Ljava/lang/String; at org.eclipse.jdt.internal.junit4.runner.JUnit4TestListener.testFailure(JUnit4TestListener.java:62) at org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:96) at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:37) at org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:93) at org.junit.internal.runners.MethodRoadie.addFailure(MethodRoadie.java:147) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:106) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) More information: Looking at the code, I can see that there are calls to getExpected() and getActual() that aren't in the API for ComparisonFailure. I'm using Eclipse 3.3.1.1.
Using Eclipse 3.3.1 and importing org.junit. version 4.3.1 in my workspace, I can see the getExpected() and getActual() methods on junit.framework.ComparisonFailure, so I guess the JUnit version you used or you put in your project's buildpath is not valid. With this configuration, your example works perfectly; I can run the test either as a JUnit or JUnit Plug-in test in a Java project or Plug-in project and got the expected failure on the second test...
Verified for 3.4M4