Spring 2.5, Eclipse and JUnit 4.4

In: Eclipse|Java

12 Dec 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.

1 Response to Spring 2.5, Eclipse and JUnit 4.4

Avatar

Climbing Back onto the Java Horse

January 22nd, 2009 at 9:20 pm

[...] bit of Googling, I worked out that I needed a newer version of JUnit than the one (v4.3.1) that came with Eclipse. [...]

Comment Form

Follow Me!

Photostream

    P1010008 (2)P1010026P1010028P1010021P1010009 (2)P1010033 (2)

RSStOMPSON's tweets