Scalatest: GeneratorDrivenPropertyChecks fails with "Found interface org.scalacheck.Test$Parameters, but class was expected"

Created on 14 Nov 2016  路  5Comments  路  Source: scalatest/scalatest

build.sbt:

"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"org.scalactic" %% "scalactic" % "3.0.0" % "test",
"org.scalacheck" %% "scalacheck" % "1.12.6" % "test",
"org.scalamock" %% "scalamock-scalatest-support" % "3.2.2" % "test"

Scala class:

import org.scalatest._
import prop._
import org.scalacheck.Gen

class ScalaCheckTestTest extends PropSpec with GeneratorDrivenPropertyChecks with Matchers {
    val strings = Gen.oneOf("", "a")
    property(s"strings are reflexive") {
        forAll(strings) { (s: String) => s should equal (s) }
    }
}

Full stack trace:

An exception or error caused a run to abort: Found interface org.scalacheck.Test$Parameters, but class was expected 
java.lang.IncompatibleClassChangeError: Found interface org.scalacheck.Test$Parameters, but class was expected
    at org.scalatest.prop.Configuration$class.getParams(Configuration.scala:444)
    at ScalaCheckTestTest.getParams(ChemspiderTest.scala:8)
    at org.scalatest.prop.GeneratorDrivenPropertyChecks$class.forAll(GeneratorDrivenPropertyChecks.scala:943)
    at ScalaCheckTestTest.forAll(ChemspiderTest.scala:8)
    at ScalaCheckTestTest$$anonfun$1.apply(ChemspiderTest.scala:12)
    at ScalaCheckTestTest$$anonfun$1.apply(ChemspiderTest.scala:12)
    at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
    at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    at org.scalatest.Transformer.apply(Transformer.scala:22)
    at org.scalatest.Transformer.apply(Transformer.scala:20)
    at org.scalatest.PropSpecLike$$anon$1.apply(PropSpecLike.scala:186)
    at org.scalatest.TestSuite$class.withFixture(TestSuite.scala:196)
    at org.scalatest.PropSpec.withFixture(PropSpec.scala:874)
    at org.scalatest.PropSpecLike$class.invokeWithFixture$1(PropSpecLike.scala:183)
    at org.scalatest.PropSpecLike$$anonfun$runTest$1.apply(PropSpecLike.scala:196)
    at org.scalatest.PropSpecLike$$anonfun$runTest$1.apply(PropSpecLike.scala:196)
    at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
    at org.scalatest.PropSpecLike$class.runTest(PropSpecLike.scala:196)
    at org.scalatest.PropSpec.runTest(PropSpec.scala:874)
    at org.scalatest.PropSpecLike$$anonfun$runTests$1.apply(PropSpecLike.scala:229)
    at org.scalatest.PropSpecLike$$anonfun$runTests$1.apply(PropSpecLike.scala:229)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:396)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
    at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:379)
    at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
    at org.scalatest.PropSpecLike$class.runTests(PropSpecLike.scala:229)
    at org.scalatest.PropSpec.runTests(PropSpec.scala:874)
    at org.scalatest.Suite$class.run(Suite.scala:1147)
    at org.scalatest.PropSpec.org$scalatest$PropSpecLike$$super$run(PropSpec.scala:874)
    at org.scalatest.PropSpecLike$$anonfun$run$1.apply(PropSpecLike.scala:233)
    at org.scalatest.PropSpecLike$$anonfun$run$1.apply(PropSpecLike.scala:233)
    at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
    at org.scalatest.PropSpecLike$class.run(PropSpecLike.scala:233)
    at org.scalatest.PropSpec.run(PropSpec.scala:874)
    at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
    at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1340)
    at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1334)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334)
    at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1011)
    at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1010)
    at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1500)
    at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
    at org.scalatest.tools.Runner$.run(Runner.scala:850)
    at org.scalatest.tools.Runner.run(Runner.scala)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:138)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Most helpful comment

I have found out, that it seems that the problem is in scalacheck version (seems that it is incompatible with the last version of scalatest). Upgrading scalacheck to 1.13.4 has solved it for me.

I have a little different scenario but the same error. So I think what has worked for me should work for you.

All 5 comments

Yeah, I have the same issue.

I have found out, that it seems that the problem is in scalacheck version (seems that it is incompatible with the last version of scalatest). Upgrading scalacheck to 1.13.4 has solved it for me.

I have a little different scenario but the same error. So I think what has worked for me should work for you.

@akozhemiakin That worked for me, too. I'm pretty surprised鈥擨 thought ScalaTest was only compatible with ScalaCheck 1.12.x.

I'm seeing this with the combo [email protected] + [email protected] per https://mvnrepository.com/artifact/org.scalatest/scalatest_2.11/3.0.5

I also tried 1.13.4 for prosperity but still seeing the same issue.

Of note, I'm a bazel scala user so 3.0.5 is my default version.

special note here this uses scala 2.11

Was this page helpful?
0 / 5 - 0 ratings