title: JMockit mock protected method in superclass and still test method in real child class
body: <p>I am still learning JMockit and need help understanding it.</p>
  
  <p>I am testing a class that uses superclass methods. My test gets a null pointer when it attempts to use the superclass method due to code inside it that uses struts action context to get the session and pull an object from the session. </p>
  
  <p>The method I want to bypass the struts session stuff inside the protected method.</p>
  
  <pre><code>public class MyExtendingClass extends MySuperClass{ 
    public void methodIamTesting(){///} 
  }
  
  public abstract class MySuperClass{
    //I want to mock this method
    protected Object myProtectedSuperClassMethod(){
  // struts action context code that returns an object//}
  }
  </code></pre>
  
  <p>Test code</p>
  
  <pre><code>@Test
  public void testRunsAndDoesntPass() {
  Mockit.setUpMock(MySuperClass.class, new MySuperClass(){       
    public Object myProtectedSuperClassMethod() {
        return object;
    }
  }); 
  
  // real class method invocation happens
  assertEquals(expected, actual);
  </code></pre>
  
  <p>}</p>
  
  <p>I keep getting NullPointers just like if I didn't have the mock
  Not sure what to try next. All the docs and code samples I have read say to just declare the superclass method as public in the setUpMock and it should work. </p>
  
  <p>I can't mock the entire class because that is the class I am testing.</p>