Home > Eclipse, Java > Spring 2.5, Eclipse and JUnit 4.4

Spring 2.5, Eclipse and JUnit 4.4

December 12th, 2007

SpringI tried to create JUnit tests for a Spring based project which I upgraded to the newest Spring version 2.5. The project is developed in Eclipse and I already got the JUnit4 library included in my Java Project:

JUnit4

To benefit from Spring JUnit support I had to add the following annotation to my test:

@RunWith(SpringJUnit4ClassRunner.class)

This caused a compilation error saying that the class org.junit.internal.runners.JUnit4ClassRunner was not found in my classpath but is needed internally from one of my imported classes (in my case SpringJUnit4ClassRunner)

I found out that JUnit 4.4 is needed to compile these new kind of Spring JUnit tests but the JUnit version bundled with Eclipse 3.3.x is 4.3:

JUnit 4.3

As this post states JUnit 4.4 will be included in the next milestone of Eclispe 3.4 - meanwhile I have to add it to my libraries manually.

Eclipse, Java



  1. No comments yet.
  1. No trackbacks yet.