Author: eric
Date: Sun Aug  8 11:59:34 2010
New Revision: 983392

URL: http://svn.apache.org/viewvc?rev=983392&view=rev
Log:
testLocalhost should be independent of the local hosts file.

Modified:
    
james/server/trunk/domain-api/src/test/java/org/apache/james/api/dnsservice/AbstractDNSServerTest.java

Modified: 
james/server/trunk/domain-api/src/test/java/org/apache/james/api/dnsservice/AbstractDNSServerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/domain-api/src/test/java/org/apache/james/api/dnsservice/AbstractDNSServerTest.java?rev=983392&r1=983391&r2=983392&view=diff
==============================================================================
--- 
james/server/trunk/domain-api/src/test/java/org/apache/james/api/dnsservice/AbstractDNSServerTest.java
 (original)
+++ 
james/server/trunk/domain-api/src/test/java/org/apache/james/api/dnsservice/AbstractDNSServerTest.java
 Sun Aug  8 11:59:34 2010
@@ -59,15 +59,13 @@ public class AbstractDNSServerTest exten
      * @throws UnknownHostException
      */
     public void testLocalhost() throws UnknownHostException {
-        assertEquals("localhost/127.0.0.1", 
DNS_SERVER.getByName("localhost").toString());
-        String localHost = 
DNS_SERVER.getHostName(InetAddress.getByName("127.0.0.1")).toString();
-        boolean match = false;
+
+       assertEquals("localhost/127.0.0.1", 
DNS_SERVER.getByName("localhost").toString());
         
-        // it may be possible that it return localhost or 127.0.0.1.
-        // This depends on the OS
-        if (localHost.equals("localhost") || localHost.equals("127.0.0.1")) 
match = true;
+       String localHost = 
DNS_SERVER.getHostName(InetAddress.getByName("127.0.0.1")).toString();
+       // We only can check if the returned localhost is not empty. Its value 
depends on the hosts file.
+       assertTrue(localHost.length() > 0);
         
-        assertTrue("Was not localhost and not 127.0.0.1", match);
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to