Sometimes, you want to test a class method and you want to do an expectation on a call of a super class method. I did not found a way to do this expectation in java using easymo
Expanding on @Cem Catikkas answer, using JMockit 1.22:
@Test
public void barShouldCallSuperBar() {
new MockUp() {
@Mock
public void bar() {
barCalled = true;
System.out.println("mocked bar");
}
};
Foo foo = new Foo();
foo.bar();
Assert.assertTrue(mockBar.barCalled);
}
No need for the static class annotated with @MockClass, it is replaced by the MockUp class.