1

Specs2 と Mockito を使用して Scala 単体テストを実行できません。

val response = mock[Response]

"MyResource" should {
    "handle NOT_FOUND from another WS" in {
      response.status returns NOT_FOUND // Exception thrown here
      anotherWS.getDetails("101010", "101") returns Future.successful(response)
      .....
    }

例外:

org.mockito.internal.invocation.Invocation.isToString(Lorg/mockito/invocation/InvocationOnMock;)Z
org.specs2.execute.Error$ThrowableException: NoSuchMethodError: org.mockito.internal.invocation.Invocation.isToString(Lorg/mockito/invocation/InvocationOnMock;)Z
Caused by: java.lang.NoSuchMethodError: org.mockito.internal.invocation.Invocation.isToString(Lorg/mockito/invocation/InvocationOnMock;)Z
    at org.mockito.internal.stubbing.defaultanswers.ReturnsEmptyValues.answer(ReturnsEmptyValues.java:59)
    at org.mockito.internal.stubbing.defaultanswers.GloballyConfiguredAnswer.answer(GloballyConfiguredAnswer.java:24)
    at org.mockito.internal.MockHandler.handle(MockHandler.java:99)
    at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:47)
4

2 に答える 2

1

mockito 1.9.5(1.8.5を使用していた)に更新すると、問題が修正されました

于 2013-10-26T17:07:40.333 に答える