class UnderTest {
fun doStuff(string1: String, string2: String = "hello world") = "do stuff"
}
@Test
fun testIt() {
val underTest = mock(UnderTest::class.java)
whenever(underTest.doStuff(anyString())).thenReturn("stuff done")
}
Use of Matchers Is Invalid Exception "This exception may occur if matchers are combined with raw values"
It should have been fixed theoretically by adding @jvmoverloads to doStuff, but it wasn't. If mockito-kotlin could figure out how to construct a matcher that matches the default value, that would be helpful, too. Alternatively, have an any() matcher generated automatically.
class UnderTest { fun doStuff(string1: String, string2: String = "hello world") = "do stuff" }
@Test fun testIt() { val underTest = mock(UnderTest::class.java) whenever(underTest.doStuff(anyString())).thenReturn("stuff done") }
Use of Matchers Is Invalid Exception "This exception may occur if matchers are combined with raw values"
It should have been fixed theoretically by adding @jvmoverloads to doStuff, but it wasn't. If mockito-kotlin could figure out how to construct a matcher that matches the default value, that would be helpful, too. Alternatively, have an any() matcher generated automatically.