Open GoogleCodeExporter opened 9 years ago
Here's my scenario: public interface Invoker { void invoke(); } public class Foo { private Invoker m_invoker; public Foo() { m_invoker = new Invoker(){ bar(); }; } protected void bar() { System.out.println("bar is indeed invoked! but the verification on spy fails"); } public doInvoke() { m_invoker.invoke(); } } ========================== public class FooTests { Foo m_foo = Mockito.spy(new Foo()); @Test public void testVerifyBarIsInvoked() { m_foo.doInvoke(); //THIS VERIFICATION FAILS.... SAYS BAR ISN'T INVOKED; mockito 1.9.5 Mockito.verify(m_foo, times(1)).bar(); } }
Original issue reported on code.google.com by Saivivek...@gmail.com on 25 Jul 2015 at 7:26
Saivivek...@gmail.com
I meant, m_invoker = new Invoker(){ public void invoke() { bar(); } }; in Foo's constructor
Original comment by Saivivek...@gmail.com on 25 Jul 2015 at 7:29
Original issue reported on code.google.com by
Saivivek...@gmail.com
on 25 Jul 2015 at 7:26