I'm trying to mock a method to have it return one specific object:
private static final String PARAM = "somevalue";
...
@Test
public void jmockit() {
final PojoClass dfault = new PojoClass();
new NonStrictExpectations() {
StaticFacade mcfg;
{
StaticFacade.getPojo(PARAM); returns(dfault);
}
};
PojoClass a = StaticFacade.getPojo(PARAM);
assertNotNull(a);
}
But I'm facing 2 issues:
- I'm getting a 'No current invocation available' at the returns call
- If I try to add the result variable I get compilation problems.
I'm using JDK1.5. Any ideas?