Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchMethodError while running Scalatest

I have created one small program and in order to test it I have write small Scala Test class. But when I tried to execute scala test I was getting below error, please advise,

java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object;
    at org.scalatest.tools.Runner$.argTooShort$1(Runner.scala:1490)
    at org.scalatest.tools.Runner$.parseReporterArgsIntoConfigurations(Runner.scala:1507)
    at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:898)
    at org.scalatest.tools.Runner$.run(Runner.scala:858)
    at org.scalatest.tools.Runner.run(Runner.scala)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:137)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
like image 851
Nishan Avatar asked Dec 12 '14 23:12

Nishan


1 Answers

I got the resolution. Thanks all for you reply.

There was a problem with my Scatatest version.

I am using Scala version 11 and scalatest version is not compatible with with Scala version.

libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.1" % "test"

Above line added in .sbt file and refreshed. Now it works fine as expected.

like image 116
Nishan Avatar answered Sep 27 '22 22:09

Nishan