What steps will reproduce the problem?
1. This code produces that behaviour:
public class MockitoBug {
// Note: protected or private, not public
class Foo {
public String fooMethod() {
throw new RuntimeException("This should not be called!");
}
}
// Note: public
public class Bar extends Foo {}
@Test
public void test() {
Bar b = Mockito.mock(Bar.class);
Mockito.when(b.fooMethod()).thenReturn(null);
// => This throws an exception because it actually calls fooMethod()
}
}
What is the expected output? What do you see instead?
Expected: Mockito.when(fooMethod()) should not call the method.
Result: it calls fooMethod (the real implementation) and we get an exception.
What version of the product are you using? On what operating system?
Version 1.8.1 on Linux
Please provide any additional information below.
I use Junit 4.
Thank you all, Mockito is great!
Original issue reported on code.google.com by mail.ab...@gmail.com on 28 Apr 2011 at 2:57
Original issue reported on code.google.com by
mail.ab...@gmail.com
on 28 Apr 2011 at 2:57