【发布时间】:2016-05-13 11:45:31
【问题描述】:
我有一个依赖的maven项目:
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>2.2.5</version>
<scope>test</scope>
</dependency>
并且有一个像这样的测试类套件:
import java.util.{LinkedHashMap => jLinkedHashMap, ArrayList => jArrayList, Arrays}
import org.scalatest._
class NeutralizeEITSuite extends FunSuite with Matchers {
val nEIT = new NeutralizeEIT()
test("Valid content category 'MiniSeries' is neutralized to 'TV Entertainment':") {
val result = neutralizedEIT(content_category = "MiniSeries")
val content_category = getStringValueFromEIT("content_category", result)
content_category should equal ("TV Entertainment")
}
}
编译过程中出现我不理解的错误:
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] C:\PROJECTS\active\Farallon\Hyperion\master\src\test\java:-1: info: compiling
[INFO] Compiling 10 source files to C:\PROJECTS\active\Farallon\Hyperion\master\target\test-classes at 1454551605523
[ERROR] error: error while loading Suite, Scala signature Suite has wrong version
[INFO] expected: 5.0
[INFO] found: 4.1 in Suite.class
[ERROR] C:\PROJECTS\active\Farallon\Hyperion\master\src\test\java\com\mycompany\ese\ingest\NeutralizeEITSuite.scala:9: error: illegal inheritance;
[INFO] self-type com.mycompany.ese.ingest.neutralizeEITSuite does not conform to org.scalatest.FunSuite's selftype org.scalatest.FunSuite
[INFO] class neutralizeEITSuite extends FunSuite with Matchers {
[INFO] ^
[ERROR] C:\PROJECTS\active\Farallon\Hyperion\master\src\test\java\com\mycompany\ese\ingest\NeutralizeEITSuite.scala:9: error: illegal inheritance;
[INFO] self-type com.mycompany.ese.ingest.neutralizeEITSuite does not conform to org.scalatest.Matchers's selftype org.scalatest.Matchers
[INFO] class neutralizeEITSuite extends FunSuite with Matchers {
[INFO] ^
[ERROR] C:\PROJECTS\active\Farallon\Hyperion\master\src\test\java\com\mycompany\ese\ingest\NeutralizeEITSuite.scala:15: error: recursive value result needs type
[INFO] val content_category = getStringValueFromEIT("content_category", result)
我试过用谷歌搜索错误,但没有结果。我的 pom.xml 中没有额外的 org.scalatest 依赖项
FunSuite 4.1 和 5.0 版在哪里?
谢谢,
【问题讨论】:
标签: scala maven dependencies scalatest test-suite