I'm trying to mock a singleton class (SessionDataManager) where I get an instance by calling the static getInstance() method but all attempts seem to return null.
I've tried
@Mocked SessionDataManager sessionDataManager;
or
new MockUp<SessionDataManager>(){
@Mock
public SessionDataManager getInstance(Invocation invocation) {
return invocation.getInvokedInstance();
}
};
I get the same result = null;
Can anyone suggestion a solution?
Thanks
I would suggest having a look at the documentation, but here are two complete example tests:
Take a look at Expectations' class: