I have the following in build.sbt:
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
libraryDependencies += "junit" % "junit" % "4.11" % "test"
I noticed that junit-interface 0.10 depends on junit-dep 4.10. This makes it impossible to compile tests that use assertNotEquals which was introduced in junit 4.11.
How do I run JUnit 4.11 test cases with SBT?
I would do this:
libraryDependencies ++= Seq(
"junit" % "junit" % "4.11" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
exclude("junit", "junit-dep")
)
By excluding what we don't desire, it doesn't interfere. This doesn't depend on ordering.
Use junit-interface 0.11 to avoid the dependency on junit-dep:
libraryDependencies += "junit" % "junit" % "4.12" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
UPDATE: junit-interface 0.11 makes this reliable by depending on junit rather than junit-dep.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With