title: Test class with a new() call in it with Mockito
body: <p>I have a legacy class that contains a <code>new()</code> call to instantiate a <code>LoginContext</code> object:</p>
  <pre><code>public class TestedClass {
    public LoginContext login(String user, String password) {
      LoginContext lc = new LoginContext(&quot;login&quot;, callbackHandler);
    }
  }
  </code></pre>
  <p>I want to test this class using Mockito to mock the <code>LoginContext</code> as it requires that the JAAS security stuff be set up before instantiating, but I'm not sure how to do that without changing the <code>login()</code> method to externalize the <code>LoginContext</code>.</p>
  <p>Is it possible using Mockito to mock the <code>LoginContext</code> class?</p>