title: Accessing nested private static class in Java
body: <p>I have following public class in Java which looks like:</p>
  
  <pre><code>public class MyClass 
  {
  
    private static class MyNestedClass&lt;T&gt; extends SomeOtherClass
    {
    }
  
  }
  </code></pre>
  
  <p>I am writing a test where I need to create a mock object for MyNestedClass class using PowerMockito, but am not able to access the class since it's private. Is there a way I can access MyNestedClass? </p>
  
  <p>I tried the following:</p>
  
  <pre><code>MyClass.MyNestedClass myNestedClass = new MyClass.MyNestedClass()
  </code></pre>
  
  <p>and </p>
  
  <pre><code>MyClass testNoteActivity = Mockito.spy(MyClass.class);
  testNoteActivity.MyNestedClass myNestedClass = new testNoteActivity.MyNestedClass()
  </code></pre>
  
  <p>Both didn't work for me.</p>