@Test public void testResolver() throws Exception { InetAddress expectedAddress = InetAddress.getLoopbackAddress(); Mockito.when(delegate.resolve("www.google.com")) .thenReturn(expectedAddress); InetAddress address = nameResolver.resolve("www.google.com"); Assert.assertSame(expectedAddress, address); Mockito.verify(delegate, Mockito.times(1)) .resolve("www.google.com"); }
@Override public InetAddress resolve(String name) throws UnknownHostException { return delegate.resolve(name); }
DelegateNameResolver implements NameResolver { @Override public InetAddress resolve(String name) throws UnknownHostException { return delegate.resolve(name); } }
DelegateNameResolver implements NameResolver { @Override public InetAddress resolve(String name) throws UnknownHostException { return delegate.resolve(name); } DelegateNameResolver(ParsecNameResolver delegate); }
DelegateNameResolver implements NameResolver { @Override public InetAddress resolve(String name) throws UnknownHostException { return delegate.resolve(name); } DelegateNameResolver(ParsecNameResolver delegate); @Override InetAddress resolve(String name); ParsecNameResolver getDelegate(); }
DelegateNameResolver implements NameResolver { @Override public InetAddress resolve(String name) throws UnknownHostException { return delegate.resolve(name); } DelegateNameResolver(ParsecNameResolver delegate); @Override InetAddress resolve(String name); ParsecNameResolver getDelegate();  }