In class MyClass that I test I have:
public void execute(){
service.call(ThisClass::method1);
}
And following:
void method1(){do 1;}
void method2(){do 2;}
And in test:
@Mock
Service service;
@Test
public void testCallMethod1()
{
MyClass myClass = new MyClass();
myClass.execute();
service.verify(any(Runnable.class));
}
And it works, but, how do I verify that parameter instead of any Runnable was method1 and not method2?
I'm looking for solution that will look like (For example, not really works):
service.verify(eq(MyClass::method1.getRunnable()))