JUnit java.lang.NoSuchMethodError: junit.framework.ComparisonFailure.getExpected()Ljava/lang/String

The getExpected() method on junit.framework.ComparisonFailure was only added in JUnit 3.8.2 (remember, junit.framework package is from JUnit 3.8, whereas JUnit 4 uses org.junit). The method wasn’t there in 3.8.1, which is the most common version of 3.x still out there.

I think the method was added for easier migration to JUnit 4 tooling, and occasionally this exception pops up on older code bases that use JUnit 3.8. The Eclipse JUnit 4 test runner would appear to switch back to calling the junit.framework.* code when running JUnit 3.8 tests.

SO I’m guessing you still have JUnit 3.8.1 lurking about on your classpath, and it’s clashing with the Eclipse test runner. Either get rid of that JAR, or “upgrade” it to 3.8.2.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)