directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject svn commit: r370617 - /directory/trunks/mina/spring/src/test/java/org/apache/mina/integration/spring/InetAddressEditorTest.java
Date Thu, 19 Jan 2006 20:27:51 GMT
Author: niklas
Date: Thu Jan 19 12:27:24 2006
New Revision: 370617

URL: http://svn.apache.org/viewcvs?rev=370617&view=rev
Log:
DIRMINA-159. Changed InetAddressEditorTest to only use DNS queries for localhost 
if there is no network connection.


Modified:
    directory/trunks/mina/spring/src/test/java/org/apache/mina/integration/spring/InetAddressEditorTest.java

Modified: directory/trunks/mina/spring/src/test/java/org/apache/mina/integration/spring/InetAddressEditorTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/spring/src/test/java/org/apache/mina/integration/spring/InetAddressEditorTest.java?rev=370617&r1=370616&r2=370617&view=diff
==============================================================================
--- directory/trunks/mina/spring/src/test/java/org/apache/mina/integration/spring/InetAddressEditorTest.java
(original)
+++ directory/trunks/mina/spring/src/test/java/org/apache/mina/integration/spring/InetAddressEditorTest.java
Thu Jan 19 12:27:24 2006
@@ -19,12 +19,12 @@
 package org.apache.mina.integration.spring;
 
 import java.net.InetAddress;
+import java.net.UnknownHostException;
 
 import junit.framework.TestCase;
 
 /**
- * Tests {@link org.apache.mina.integration.spring.InetAddressEditor}. NOTE:
- * This test does DNS queries so it needs network access to succeed.
+ * Tests {@link org.apache.mina.integration.spring.InetAddressEditor}.
  * 
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
@@ -40,9 +40,19 @@
 
     public void testSetAsTextWithHostName() throws Exception
     {
-        editor.setAsText( "www.google.com" );
-        assertEquals( InetAddress.getByName( "www.google.com" ), editor
-                .getValue() );
+        try
+        {
+            InetAddress expected = InetAddress.getByName( "www.google.com" );
+            editor.setAsText( "www.google.com" );
+            assertEquals( expected, editor.getValue() );
+        }
+        catch( UnknownHostException uhe )
+        {
+            // No DNS. Skip the test.
+        }
+        
+        editor.setAsText( "localhost" );
+        assertEquals( InetAddress.getByName( "localhost" ), editor.getValue() );
     }
 
     public void testSetAsTextWithIpAddress() throws Exception



Mime
View raw message