我正在尝试在 intellij 中为基于 sbt 的 Scala 应用程序运行测试。但我收到以下错误,我不确定如何修复:
Testing started at 21:07 ...
java.lang.IncompatibleClassChangeError: Found class scala.collection.mutable.ArrayOps, but interface was expected
at org.scalatest.tools.Runner$.checkArgsForValidity(Runner.scala:895)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:729)
at org.scalatest.tools.Runner$.run(Runner.scala:711)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:144)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
当我用 Junit runner 属性装饰我的类时,它们工作得很好(就视觉效果而言,它实际上是一个更好的运行):
@RunWith(classOf[JUnitRunner])