This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f720f2  [TEXT-170] Add String lookup for host names and IP addresses 
(#118)
8f720f2 is described below

commit 8f720f28e8ea7c50bd7a80f0b4f851fede642af7
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Sun Aug 4 11:55:40 2019 -0400

    [TEXT-170] Add String lookup for host names and IP addresses (#118)
    
    Make test more reliable.
---
 .../java/org/apache/commons/text/lookup/DnsStringLookupTest.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java 
b/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java
index fed3797..fd0e7c0 100644
--- a/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java
@@ -59,8 +59,13 @@ public class DnsStringLookupTest {
     @Test
     public void testName() throws UnknownHostException {
         final String address = InetAddress.getLocalHost().getHostAddress();
-        final InetAddress localHost = InetAddress.getByName(address);
-        Assertions.assertEquals(localHost.getHostName(), 
DnsStringLookup.INSTANCE.lookup("name|" + address + ""));
+        final InetAddress[] localHostAll = InetAddress.getAllByName(address);
+        boolean matched = false;
+        for (InetAddress localHost : localHostAll) {
+            if 
(localHost.getHostName().equals(DnsStringLookup.INSTANCE.lookup("name|" + 
address + "")))
+                matched = true;
+        }
+        Assertions.assertTrue(matched);
     }
 
     @Test

Reply via email to