I downloaded the Scala IDE Linux - 64 bit For Scala 2.11.2 and am trying to run a Scala Test. Following is my code.
package ppg.experiment.gameofbusiness.engine
import org.scalatest.FlatSpec
import org.scalatest.Matchers
class DiceSpec extends FlatSpec with Matchers {
"A dice" should "roll a value greater than zero" in {
new Dice().roll > 0
}
it should "roll a value less than six" in {
new Dice().roll < 7
}
}
When I right click and run as Scala Test the following is printed on the console
WARNING: -p has been deprecated and will be reused for a different (but still very cool) purpose in ScalaTest 2.0. Please change all uses of -p to -R.
java.lang.reflect.InvocationTargetException
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:606)
at scala.tools.eclipse.scalatest.launching.ScalaTestLauncher$.main(ScalaTestLauncher.scala:58)
at scala.tools.eclipse.scalatest.launching.ScalaTestLauncher.main(ScalaTestLauncher.scala)
Caused by: java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object;
at org.scalatest.tools.Runner$.argTooShort$1(Runner.scala:1515)
at org.scalatest.tools.Runner$.parseReporterArgsIntoConfigurations(Runner.scala:1532)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:923)
at org.scalatest.tools.Runner$.main(Runner.scala:860)
at org.scalatest.tools.Runner.main(Runner.scala)
... 6 more
Can someone tell me how to solve this problem?
Check your classpath; in particular check that the version of scalatest you're depending on is compiled for scala 2.11, not 2.10.