Verifying by-name parameters in Mockito
问题 Given class UnderTest { def f(arg1: Int)(arg2: => Int) = ??? } Trying do do this: import org.mockito.Matchers val objUnderTest = mock[UnderTest] verify(objUnderTest).f(Matchers.eq(1))(Matchers.any()) fails with an "Invalid use of argument matchers!" exception, complaining that 2 matchers were expected, 1 was recorded. Is using Mockito to verify calls to functions with multiple argument lists including by-name parameters possible? 回答1: To my knowledge you can not mock byname parameters with