Search code examples
scalamavendependenciesscalatesttest-suite

ScalaTest I get error while loading Suite, Scala signature Suite has wrong version


I have a maven project with dependency:

<dependency>
    <groupId>org.scalatest</groupId>
    <artifactId>scalatest_2.11</artifactId>
    <version>2.2.5</version>
    <scope>test</scope>
</dependency>

And have a test class suite like so:

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

I get an error during compilation that I do not understand:

[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)

I've tried googling the error but no results. I don't have additional org.scalatest dependencies in my pom.xml

Where is this version 4.1 and 5.0 for FunSuite?

Thanks,


Solution

  • The problem was fixed by updaing the scala specs dependency in my pom

    from

        <dependency>
            <groupId>org.specs</groupId>
            <artifactId>specs</artifactId>
            <version>1.6.2.2_1.5.0</version>
            <scope>test</scope>
        </dependency>
    

    to

        <dependency>
            <groupId>org.scala-tools.testing</groupId>
            <artifactId>specs</artifactId>
            <version>1.6.2.2_1.5.0</version>
        </dependency>