I'm trying to use scalamock / scalatest and I always have an error during testing
My build.sbt
name := "name"
organization := "org"
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.7"
scalacOptions ++= Seq("-feature", "-language:postfixOps","-language:existentials")
libraryDependencies <<= scalaVersion { scala_version =>
val sparkVersion = "1.5.1"
Seq(
"org.scalatest" %% "scalatest" % "2.2.5" % "test",
"org.scalamock" %% "scalamock-scalatest-support" % "3.2" % "test",
"junit" % "junit" % "4.11" % "test",
"org.apache.spark" %% "spark-streaming" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-core" % sparkVersion,
"com.typesafe" % "config" % "1.3.0"
)
}
My unit test :
@Test
class BWPMDAOTest extends FlatSpec with Matchers with MockFactory{
val sparkcontext = mock[SparkContext]
val dao = new BWPMDAO(sparkcontext)
dao.getStatsAsList() should not be null
dao.getStatsAsList() should not be empty
}
When I run sbt test
I have the following error:
Error:scalac: missing or invalid dependency detected while loading class file 'MetricsSystem.class'.
Could not access term eclipse in package org,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'MetricsSystem.class' was compiled against an incompatible version of org.
How can I solve that ?
Thanks