Unfortunately, there is no translation for this page. We have redirected you to the english version of the site. We are sorry for any inconvenience caused...

JUnit problem - java.lang.NoSuchMethodError: junit.framework.TestCase.getName()Ljava/lang/String;

 

Recently I switched to Junit 4.6 and started noticing the following error JUnit problem - java.lang.NoSuchMethodError: junit.framework.TestCase.getName()Ljava/lang/String; when JUnit tries to assert strings.

After looking at it more closely and googling a little I have found the cause of the problem. I am using dbUnit which in its own respect is dependant on JUnit and its dependency was lower version of JUnit that I was using which caused the above error.

In order to fix this issue you need to open build path and reaarange the jar depencies order to that JUnit jar is above all other jars like so:

Eclipse JUnit multi dependency problem

After doing so the assertion should work normally.

Enjoy :-)

Эта страница была обновлена: 15/02/2010 09:28