我正在尝试将我的项目设置为使用 scalatest 和 scalamock。我正在使用 scala 版本 2.10.0。
但是,我似乎无法获得正确的依赖关系。
我从这段代码开始:
class ControllerTest extends org.scalatest.FunSuite
with org.scalamock.scalatest.MockFactory {}
我尝试了两种版本组合:
1)
- org.scalatest:scalatest_2.10:1.9.1
- org.scalamock:scalamock-scalatest-support_2.10:3.0.1
这就是我得到的:
scala: bad symbolic reference.
A signature in MockFactory.class refers to type SuiteMixin in package org.scalatest which is not available.
It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling MockFactory.class.
注意:在scalamock 文档中,指定的工件 id 没有尾随 _2.10,但 maven 找不到任何这样命名的工件。另外,我在他们的网站上找不到 scalamock 应该使用的 scalatest 版本。
2)
- org.scalatest:scalatest_2.10:1.9.1
- org.scalamock:scalamock-scalatest-support_2.10.0-RC5:3.0-M8
编译器说:
scala: overriding method nestedSuites in trait SuiteMixin of type => scala.collection.immutable.IndexedSeq[org.scalatest.Suite];
method nestedSuites in trait Suite of type => List[org.scalatest.Suite] has incompatible type
class ControllerTest extends FunSuite with MockFactory {
和
scala: class ControllerTest needs to be abstract, since:
it has 5 unimplemented members.
/** As seen from class ControllerTest, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
def rerunner: Option[String] = ???
def run(testName: Option[String],args: org.scalatest.Args): org.scalatest.Status = ???
protected def runNestedSuites(args: org.scalatest.Args): org.scalatest.Status = ???
protected def runTest(testName: String,args: org.scalatest.Args): org.scalatest.Status = ???
protected def runTests(testName: Option[String],args: org.scalatest.Args): org.scalatest.Status = ???
那么,这个 SuiteMixin 特性是怎么回事?
如果我使用 scalatest-support_2.10.0-RC5:3.0-M8,它似乎存在于scalatest lib中。
如果我使用 scalatest-support_2.10:3.0.1,它似乎已经从所说的 scalatest 库中消失了。
这是什么魔法?而且,更重要的是,我应该使用什么版本组合来使其工作?
谢谢!