Skip to content

Compatibility with Spring 4.3 and above #85

Description

@petermant

I have a project with a dependency on Spring Batch Test 4.1.0-RELEASE, which brings in Spring Test 5.1.2-RELEASE with it.

If I include junit-interface on the classpath, and plain dependencies (no exclusions) then ./sbt test gives:

[debug] Test run started
[debug] Test run finished: 0 failed, 0 ignored, 0 total, 0.001s

I have tried updated the dependencies to exclude JUnit 4.12, as follows:

libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
libraryDependencies += "org.springframework.batch" % "spring-batch-test" % "4.1.0.RELEASE" % "test" exclude("junit", "junit")

This gives the following from ./sbt test:

[debug] Running TaskDef(LoadInternalUsersTests, com.novocode.junit.RunWithFingerprint@310e1f40, false, [SuiteSelector])
...snip...
[error] Test LoadInternalUsersTests.initializationError failed: java.lang.ExceptionInInitializerError: null, took 0.004 sec
[error] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] ...
[error] Caused by: java.lang.IllegalStateException: SpringJUnit4ClassRunner requires JUnit 4.12 or higher.
[error] at org.springframework.util.Assert.state(Assert.java:73)
[error] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:104)

In SpringJUnit4ClassRunner.java there is a note saying "As of Spring Framework 4.3, this class requires JUnit 4.12 or higher".

Is there a reason why junit-interface won't run the tests when JUnit 4.12 is on the classpath and 4.11 is evicted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions