NoSuchMethodError while running Scalatest

I created one small program, and to test it, I wrote a small Scala Test class. But when I tried to run the Scala test, I got below the error, let us know

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) 
+6
source share
1 answer

I got permission. Thanks to everyone for the answer.

A problem with my version of Scatatest has arisen.

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

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

An .sbt file is added above the line and updated. Now it works fine as expected.

+5
source

Source: https://habr.com/ru/post/979529/


All Articles