diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-12-12 08:37:56 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-12-12 08:38:06 -0600 |
commit | 3ca1b28f07f5a46fbeca439677a98245e50b69ea (patch) | |
tree | b42339d5ce04c9f48966fa1e8e5958fab0da4403 /cadi/client/src/test/java | |
parent | deb396a3d53a84b2eb5a46d40122b4902d72c601 (diff) |
Fix DNSLocator JUnit
Issue-ID: AAF-1060
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Change-Id: I24318cc0d5b698b7719afb20c411895fda001bff
Diffstat (limited to 'cadi/client/src/test/java')
-rw-r--r-- | cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java index e2c8f828..77213e6a 100644 --- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java +++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java @@ -27,7 +27,9 @@ import static org.junit.Assert.fail; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.net.InetAddress; import java.net.URI; +import java.net.UnknownHostException; import org.junit.Before; import org.junit.Test; @@ -94,8 +96,17 @@ public class JU_DNSLocator { @Test public void refreshTest() throws LocatorException { - DNSLocator dl = new DNSLocator(access, "https", "bogushost", "8100-8101"); - assertThat(dl.refresh(), is(false)); + DNSLocator dl = new DNSLocator(access, "https", "bogushost", "8100-8101", + // Note: Lambda would be nice but need JDK 1.7 still + // PowerMock couldn't do InetAddress + new DNSLocator.DNSLookup() { + @Override + public InetAddress[] getAllByName(String host) throws UnknownHostException { + return new InetAddress[0]; + } + } + ); + assertThat(dl.refresh(), is(true)); } @Test(expected = LocatorException.class) |