@RunWith(classOf[MockitoJUnitRunner])
class ScalaTest {
var x = mock[java.util.Map]
val y = mock[ClassA]
val z = mock[ClassB]
}
pom ファイルに設定した依存関係に関係なく、モックを機能させることができません。コンパイラは、シンボルMock
とClassOf
. 以下に依存関係を示しました。
<dependency>
<groupId>org.scalamock</groupId>
<artifactId>scalamock-scalatest-support_${scala.version}</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.scalamock</groupId>
<artifactId>scalamock-junit3-support_${scala.version}</artifactId>
<version>2.4</version>
</dependency>
テストの依存関係は次のとおりです。
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.version}</artifactId>
<version>2.0.M3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
これらは私の輸入品です:
import org.junit.{Test, Before}
import org.junit.runner.RunWith
import org.mockito.runners.MockitoJUnitRunner
助言がありますか??