Say I have a class MockLoginHelper
that I mocked using jmockit
. And I would like to change the behaviour of one of the method getSDKConfig
. Inside this method I would like to call the original LoginHelper.relogin
. My eclipse thinks relogin();
below is undefined. So, how do I call a real method from a mocked class?
class MockLoginHelper extends MockUp<LoginHelper> {
@Tested
private SDKConfiguration config;
@Mock
public SDKConfiguration getSDKConfig() {
System.out.println("");
System.out.println("Mocked " + this.getClass().getSimpleName());
if (config == null) {
try {
relogin();
} catch (Exception e) {
System.err.println("failed to relogin");
e.printStackTrace();
}
}
return config;
}
}