0

scalamock / scalatest を使用しようとしていますが、テスト中に常にエラーが発生します

私の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"
  )
}

私の単体テスト:

@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
}

実行するsbt testと、次のエラーが発生します。

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.

どうすれば解決できますか?

ありがとう

4

1 に答える 1

0

たとえばsbtのjetty依存関係を追加する"org.eclipse.jetty" % "jetty-servlet" % "9.3.9.v20160517"と、機能しました。

于 2016-06-06T12:14:48.923 に答える