title: How to mock out InetAddress.getLocalHost() using JMockit
body: <p>The InetAddress constructor is not visible because the factory pattern is used.</p>
  
  <pre><code>final InetAddress anyInstance = InetAddress.getLocalHost();
      new NonStrictExpectations(InetAddress.class) {
        {
          anyInstance.getHostAddress();
          result = "192.168.0.101";
        }
      };
  </code></pre>
  
  <p>When I try to use the factory method to get an instance for partial mocking I get the error: </p>
  
  <pre><code>java.lang.IllegalStateException: Missing invocation to mocked type at this point; please make sure such invocations appear only after the declaration of a suitable mock field or parameter
  </code></pre>