Author: ieugen
Date: Sun Mar 11 22:00:35 2012
New Revision: 1299460

URL: http://svn.apache.org/viewvc?rev=1299460&view=rev
Log:
JAMES-1393

- updated tests to juni 4.x style
- added @Override and reformated code
Issue #JAMES-1393 - Upgrate all test suites to junit 4.10

Modified:
    
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
    
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/DNSFixture.java
    
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/MockDNSService.java

Modified: 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java?rev=1299460&r1=1299459&r2=1299460&view=diff
==============================================================================
--- 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
 (original)
+++ 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
 Sun Mar 11 22:00:35 2012
@@ -23,35 +23,39 @@ import java.net.UnknownHostException;
 
 import org.apache.james.dnsservice.api.mock.MockDNSService;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
+import org.junit.Test;
 
 /**
  * Basic tests for AbstractDNSServer. The goal is to verify that the interface
  * remains constants and that the built platform has access to the Internet.
  */
-public class AbstractDNSServiceTest extends TestCase {
+public class AbstractDNSServiceTest {
 
     /**
      * Simple Mock DNSService relaying on InetAddress.
      */
     private static final DNSService DNS_SERVER = new MockDNSService() {
 
-        public String getHostName(InetAddress inet) {
-            return inet.getCanonicalHostName();
-        }
-
-        public InetAddress[] getAllByName(String name) throws 
UnknownHostException {
-            return InetAddress.getAllByName(name);
-        }
-
-        public InetAddress getLocalHost() throws UnknownHostException {
-            return InetAddress.getLocalHost();
-        }
-
-        public InetAddress getByName(String host) throws UnknownHostException {
-            return InetAddress.getByName(host);
-        }
-
+       @Override
+       public String getHostName(InetAddress inet) {
+           return inet.getCanonicalHostName();
+       }
+
+       @Override
+       public InetAddress[] getAllByName(String name) throws 
UnknownHostException {
+           return InetAddress.getAllByName(name);
+       }
+
+       @Override
+       public InetAddress getLocalHost() throws UnknownHostException {
+           return InetAddress.getLocalHost();
+       }
+
+       @Override
+       public InetAddress getByName(String host) throws UnknownHostException {
+           return InetAddress.getByName(host);
+       }
     };
 
     /**
@@ -59,14 +63,15 @@ public class AbstractDNSServiceTest exte
      * 
      * @throws UnknownHostException
      */
+    @Test
     public void testLocalhost() throws UnknownHostException {
 
-        assertEquals("localhost/127.0.0.1", 
DNS_SERVER.getByName("localhost").toString());
+       assertEquals("localhost/127.0.0.1", 
DNS_SERVER.getByName("localhost").toString());
 
-        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);
+       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);
 
     }
 
@@ -75,8 +80,8 @@ public class AbstractDNSServiceTest exte
      * 
      * @throws UnknownHostException
      */
+    @Test
     public void testApache() throws UnknownHostException {
-        assertEquals(true, 
DNS_SERVER.getByName("www.apache.org").toString().startsWith("www.apache.org"));
+       assertEquals(true, 
DNS_SERVER.getByName("www.apache.org").toString().startsWith("www.apache.org"));
     }
-
 }

Modified: 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/DNSFixture.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/DNSFixture.java?rev=1299460&r1=1299459&r2=1299460&view=diff
==============================================================================
--- 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/DNSFixture.java
 (original)
+++ 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/DNSFixture.java
 Sun Mar 11 22:00:35 2012
@@ -31,58 +31,64 @@ public class DNSFixture {
     public static final String LOCALHOST_IP_V4_ADDRESS_0 = "localhost/16";
     public static final String LOCALHOST_IP_V4_ADDRESS_1 = "172.16.0.0/16";
     public static final String LOCALHOST_IP_V4_ADDRESS_2 = 
"192.168.1.0/255.255.255.0";
-    public static final String[] LOCALHOST_IP_V4_ADDRESSES = new String[] { 
LOCALHOST_IP_V4_ADDRESS_0, LOCALHOST_IP_V4_ADDRESS_1, LOCALHOST_IP_V4_ADDRESS_2 
};
-    public static final String[] LOCALHOST_IP_V4_ADDRESSES_DUPLICATE = new 
String[] { LOCALHOST_IP_V4_ADDRESS_1, LOCALHOST_IP_V4_ADDRESS_1, 
LOCALHOST_IP_V4_ADDRESS_2, LOCALHOST_IP_V4_ADDRESS_2 };
-
+    public static final String[] LOCALHOST_IP_V4_ADDRESSES = new 
String[]{LOCALHOST_IP_V4_ADDRESS_0,
+       LOCALHOST_IP_V4_ADDRESS_1, LOCALHOST_IP_V4_ADDRESS_2};
+    public static final String[] LOCALHOST_IP_V4_ADDRESSES_DUPLICATE = new 
String[]{LOCALHOST_IP_V4_ADDRESS_1,
+       LOCALHOST_IP_V4_ADDRESS_1, LOCALHOST_IP_V4_ADDRESS_2, 
LOCALHOST_IP_V4_ADDRESS_2};
     public static final String LOCALHOST_IP_V6_ADDRESS_0 = 
"00:00:00:00:00:00:00:1";
     public static final String LOCALHOST_IP_V6_ADDRESS_1 = 
"2781:0db8:1234:8612:45ee:0000:f05e:0001/48";
-    public static final String[] LOCALHOST_IP_V6_ADDRESSES = new String[] { 
LOCALHOST_IP_V6_ADDRESS_0, LOCALHOST_IP_V6_ADDRESS_1 };
-    public static final String[] LOCALHOST_IP_V6_ADDRESSES_DUPLICATE = new 
String[] { LOCALHOST_IP_V6_ADDRESS_0, LOCALHOST_IP_V6_ADDRESS_0, 
LOCALHOST_IP_V6_ADDRESS_1, LOCALHOST_IP_V6_ADDRESS_1 };
-
+    public static final String[] LOCALHOST_IP_V6_ADDRESSES = new 
String[]{LOCALHOST_IP_V6_ADDRESS_0,
+       LOCALHOST_IP_V6_ADDRESS_1};
+    public static final String[] LOCALHOST_IP_V6_ADDRESSES_DUPLICATE = new 
String[]{LOCALHOST_IP_V6_ADDRESS_0,
+       LOCALHOST_IP_V6_ADDRESS_0, LOCALHOST_IP_V6_ADDRESS_1, 
LOCALHOST_IP_V6_ADDRESS_1};
     /**
      * A Mock DNS Server that handles IPv4-only InetAddress.
      */
     public static final DNSService DNS_SERVER_IPV4_MOCK = new MockDNSService() 
{
 
-        public String getHostName(InetAddress inet) {
-            return "localhost";
-        }
-
-        public InetAddress[] getAllByName(String name) throws 
UnknownHostException {
-            return new InetAddress[] { InetAddress.getByName("127.0.0.1") };
-        }
-
-        public InetAddress getLocalHost() throws UnknownHostException {
-            return InetAddress.getLocalHost();
-        }
-
-        public InetAddress getByName(String host) throws UnknownHostException {
-            return InetAddress.getByName(host);
-        }
-
+       @Override
+       public String getHostName(InetAddress inet) {
+           return "localhost";
+       }
+
+       @Override
+       public InetAddress[] getAllByName(String name) throws 
UnknownHostException {
+           return new InetAddress[]{InetAddress.getByName("127.0.0.1")};
+       }
+
+       @Override
+       public InetAddress getLocalHost() throws UnknownHostException {
+           return InetAddress.getLocalHost();
+       }
+
+       @Override
+       public InetAddress getByName(String host) throws UnknownHostException {
+           return InetAddress.getByName(host);
+       }
     };
-
     /**
      * A Mock DNS Server that handles IPv6-only InetAddress.
      */
     public static final DNSService DNS_SERVER_IPV6_MOCK = new MockDNSService() 
{
 
-        public String getHostName(InetAddress inet) {
-            return "localhost";
-        }
-
-        public InetAddress[] getAllByName(String name) throws 
UnknownHostException {
-            return new InetAddress[] { InetAddress.getByName("::1") };
-        }
-
-        public InetAddress getLocalHost() throws UnknownHostException {
-            return InetAddress.getLocalHost();
-        }
-
-        public InetAddress getByName(String host) throws UnknownHostException {
-            return InetAddress.getByName(host);
-        }
-
+       @Override
+       public String getHostName(InetAddress inet) {
+           return "localhost";
+       }
+
+       @Override
+       public InetAddress[] getAllByName(String name) throws 
UnknownHostException {
+           return new InetAddress[]{InetAddress.getByName("::1")};
+       }
+
+       @Override
+       public InetAddress getLocalHost() throws UnknownHostException {
+           return InetAddress.getLocalHost();
+       }
+
+       @Override
+       public InetAddress getByName(String host) throws UnknownHostException {
+           return InetAddress.getByName(host);
+       }
     };
-
 }

Modified: 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/MockDNSService.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/MockDNSService.java?rev=1299460&r1=1299459&r2=1299460&view=diff
==============================================================================
--- 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/MockDNSService.java
 (original)
+++ 
james/server/trunk/dnsservice-api/src/test/java/org/apache/james/dnsservice/api/mock/MockDNSService.java
 Sun Mar 11 22:00:35 2012
@@ -32,43 +32,48 @@ public class MockDNSService implements D
     /**
      * @see org.apache.james.dnsservice.api.DNSService#findMXRecords(String)
      */
+    @Override
     public Collection<String> findMXRecords(String hostname) {
-        throw new UnsupportedOperationException("Unimplemented Stub Method");
+       throw new UnsupportedOperationException("Unimplemented Stub Method");
     }
 
     /**
      * @see org.apache.james.dnsservice.api.DNSService#findTXTRecords(String)
      */
+    @Override
     public Collection<String> findTXTRecords(String hostname) {
-        throw new UnsupportedOperationException("Unimplemented Stub Method");
+       throw new UnsupportedOperationException("Unimplemented Stub Method");
     }
 
     /**
      * @see org.apache.james.dnsservice.api.DNSService#getAllByName(String)
      */
+    @Override
     public InetAddress[] getAllByName(String host) throws UnknownHostException 
{
-        throw new UnsupportedOperationException("Unimplemented Stub Method");
+       throw new UnsupportedOperationException("Unimplemented Stub Method");
     }
 
     /**
      * @see org.apache.james.dnsservice.api.DNSService#getByName(String)
      */
+    @Override
     public InetAddress getByName(String host) throws UnknownHostException {
-        throw new UnsupportedOperationException("Unimplemented Stub Method");
+       throw new UnsupportedOperationException("Unimplemented Stub Method");
     }
 
     /**
      * @see 
org.apache.james.dnsservice.api.DNSService#getHostName(java.net.InetAddress)
      */
+    @Override
     public String getHostName(InetAddress addr) {
-        throw new UnsupportedOperationException("Unimplemented Stub Method");
+       throw new UnsupportedOperationException("Unimplemented Stub Method");
     }
 
     /**
      * @see org.apache.james.dnsservice.api.DNSService#getLocalHost()
      */
+    @Override
     public InetAddress getLocalHost() throws UnknownHostException {
-        throw new UnsupportedOperationException("Unimplemented Stub Method");
+       throw new UnsupportedOperationException("Unimplemented Stub Method");
     }
-
 }



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

Reply via email to