title: how to mock inetaddress.getlocalhost().gethostname() to throw an exception
body: <p>I want my junit test coverage to include default method from interface. Following is the method from the interface</p>
  <pre><code>public default String getServerAddress() {
      try {
          return InetAddress.getLocalHost().getHostAddress();
      } catch (Exception e) {
           return null;
      }
  }
  </code></pre>
  <p>My target is to cover exception part of this method. So i probably need to mock InetAddress to make it throw exception. But i'm not sure how?
  I tried to mock inetAddress and do the following but doesn't seem to be working:</p>
  <pre><code>when(inetAddress.getLocalHost().getHostAddress()).thenThrow(Exception.class)
  </code></pre>