Mockito: You cannot use argument matchers outside of verification or stubbing
I am trying to run the following simple test in Kotlin using Junit4 and Mockito
open class B {
lateinit var a: A
public fun bFun(value: Int) : Int {
return a.aFun(value)
}
}
@ExtendWith(MockitoExtension::class)
@RunWith(SpringJUnit4ClassRunner::class)
class TestB {
@Mock
lateinit var a: A
@InjectMocks
lateinit var b: B
@Test
fun testB() {
`when`(a.aFun(eq(1))).thenReturn(2)
assertThat(b.bFun(1) == 2)
}
}
However, I am...