Mocking UserManager

Is it possible to mock out the UserManager class? I’m using JMock at the moment and it is invoking the constructor which obviously I don’t want. Looking at the source code I can see the comment:

public class UserManager implements IQResultListener {

// Wrap this guy up so we can mock out the UserManager class.

private static class UserManagerContainer {

private static UserManager instance = new UserManager();

}

I just wondered if this had been done or if there were any plans to do this (or if it’s just me missing something and doing it wrong!).

My test setUp method looks like this:

@Before

public void setUp(){

context = new JUnit4Mockery(){{

     setImposteriser(ClassImposteriser.INSTANCE);

 }};

testObj = new ChatMemberCreatorImpl();

userManagerMock = context.mock(UserManager.class);

}