我无法从 Maven 中运行我的 scalachecks。例如下面的小片段
@RunWith(classOf[JUnitRunner])
final class MyTest extends FunSuite with Checkers {
test("t2") {
Prop.forAll( (a: String, b: String) => (a+b).startsWith(a) )
}
}
最终转储以下堆栈:
java.lang.NoSuchMethodError: scala.runtime.IntRef.zero()Lscala/runtime/IntRef;
at org.scalacheck.Gen$.frequency(Gen.scala)
at org.scalacheck.Gen$.chooseNum(Gen.scala:455)
at org.scalacheck.Arbitrary$$anonfun$arbInt$1.apply(Arbitrary.scala:86)
at org.scalacheck.Arbitrary$$anonfun$arbInt$1.apply(Arbitrary.scala:86)
at org.scalacheck.Arbitrary$$anon$2.arbitrary$lzycompute(Arbitrary.scala:65)
at org.scalacheck.Arbitrary$$anon$2.arbitrary(Arbitrary.scala:65)
at org.scalacheck.Arbitrary$.arbitrary(Arbitrary.scala:69)
at org.scalacheck.Arbitrary$$anonfun$arbContainer$1.apply(Arbitrary.scala:299)
at org.scalacheck.Arbitrary$$anonfun$arbContainer$1.apply(Arbitrary.scala:299)
at org.scalacheck.Arbitrary$$anon$2.arbitrary$lzycompute(Arbitrary.scala:65)
at org.scalacheck.Arbitrary$$anon$2.arbitrary(Arbitrary.scala:65)
at org.scalacheck.Arbitrary$.arbitrary(Arbitrary.scala:69)
at org.scalacheck.Prop$.forAll(Prop.scala:726)
at org.scalacheck.Prop$.forAll(Prop.scala:734)
我敢打赌这只是一件很小的事情要解决,但我找不到使用 junit-runner 在 scalatest 中运行 scala-check 的完整示例。
谢谢并恭祝安康
马库斯