Skip to content

Spring TestContext Framework not compatible with JUnit 4.5 [SPR-5145] #9818

@spring-projects-issues

Description

@spring-projects-issues

Alison Rosewarne opened SPR-5145 and commented

After upgrading to junit 4.5 my test class which uses the SpringJUnit4ClassRunner gets a NoClassDefFoundError:

org.apache.maven.surefire.booter.SurefireExecutionException: org/junit/Assume$AssumptionViolatedException; nested exception is java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:240)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:142)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)

etc.

This is a Junit 4.5 issue. The static class AssumptionViolatedException within org.junit.Assume that existed in 4.4 has become org.junit.internal.AssumptionViolatedException.

The file tiger/mock/org/springframework/test/context/junit4/SpringMethodRoadie.java imports org.junit.Assume.AssumptionViolatedException which is why my test is failing.

Workaround is to stick with Junit 4.4.

(Aside: are there plans to create a "SpringTEST" component?).


Affects: 2.5.5

Attachments:

Issue Links:

Referenced from: commits d159195, c0c9501, 9daae23, e5d2570, 751e0f0, 62c991f, 6327b34

3 votes, 11 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions