I'm using jmockit with my tests and with one class I wish to test, uses `InitialContext` directly. So I have the following:

```
public class MyClass {
  public void myMethod() {
    InitialContext ic = new InitialContext();
    javax.mail.Session mailSession = ic.lookup("my.mail.session");

    // rest of method follows.....
  }

```

In my test case, I call this to use my "mocked" `InitialContext` class:

```
Mockit.redefineMethods(InitialContext.class, MockInitialContext.class);

```

What is the best way to mock the `InitialContext` class with jmockit.

I've already tried a few ways (such as using my own `MockInitialContextFactory`), but keeping stumbling into the same error:

```
NoClassDefFoundError: my.class.MockInitialContext

```

From what I can see on Google, mocking with JNDI is quite nasty. Please can anyone provide me with some guidance, or point me to a solution? That would be much appreciated. Thank you.