You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceHelloSrv {
funsayHello(to:String): String
}
classAnyTest {
@Test fun`should create non-null values`() {
mock<HelloSrv> {
on { sayHello(argThat { this=="A" }) } doReturn "A"
on { sayHello(argThat { this=="B" }) } doReturn "B"// <--- fails here
}
}
}
fails with
kotlin.TypeCastException: null cannot be cast to non-null type kotlin.String
at kkk.command.AnyTest$should create non-null values$mock$1$1$$special$$inlined$argThat$1.matches(Mockito.kt:55)
at org.mockito.internal.invocation.TypeSafeMatching.apply(TypeSafeMatching.java:24)
at org.mockito.internal.invocation.MatcherApplicationStrategy.forEachMatcherAndArgument(MatcherApplicationStrategy.java:82)
at org.mockito.internal.invocation.InvocationMatcher.argumentsMatch(InvocationMatcher.java:152)
at org.mockito.internal.invocation.InvocationMatcher.matches(InvocationMatcher.java:81)
at org.mockito.internal.stubbing.InvocationContainerImpl.findAnswerFor(InvocationContainerImpl.java:82)
at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:88)
at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:32)
at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:36)
at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:41)
at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptAbstract(MockMethodInterceptor.java:120)
at kkk.command.HelloSrv$MockitoMock$934695312.sayHello(Unknown Source)
at kkk.command.AnyTest$should create non-null values$mock$1$2.invoke(AnyTest.kt:16)
at kkk.command.AnyTest$should create non-null values$mock$1$2.invoke(AnyTest.kt:12)
at com.nhaarman.mockito_kotlin.KStubbing.on(Mockito.kt:119)
at kkk.command.AnyTest.should create non-null values(AnyTest.kt:16)
mockito-kotlin: 1.0.0
mockito: 2.2.28
The text was updated successfully, but these errors were encountered:
fails with
mockito-kotlin: 1.0.0
mockito: 2.2.28
The text was updated successfully, but these errors were encountered: