title: How to fake InitialContext with default constructor
body: <p>All,</p>
  
  <p>I'm trying to do some unit testing in some archaic java code (no interfaces, no abstraction, etc.)</p>
  
  <p>This is a servlet that uses a ServletContext (which I'm assuming is set up by Tomcat) and it has database information is set up in the web.xml/context.xml file. Now, I've figured out how to make a Fake ServletContext, but the code has </p>
  
  <pre><code> InitialContext _ic = new InitialContext();
  </code></pre>
  
  <p>all over the place (so it isn't feasible to replace it). I need to find a way to make a default InitialContext() able to do the <code>_ic.lookup(val)</code> without throwing an exception.</p>
  
  <p>I'm assuming there is some way that the context.xml is getting loaded, but how that magic works, I'm drawing a blank. Anyone have any ideas?</p>