/*
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lenya.net;

import java.net.InetAddress;

import junit.framework.TestCase;

/**
 * Inet address util test
 */
public class InetAddressUtilTest extends TestCase {
    
    public void testInetAddressUtil() {
        
        String[] args = { "195.226.6.64", "255.255.255.0", "195.226.6.70" };
        
        if (args.length != 3) {
            System.out.println("Usage: InetAddressUtilTest network subnet ip");
            return;
        }

        try {
            InetAddress network = InetAddress.getByName(args[0]); // "195.226.6.64");
            InetAddress subnet = InetAddress.getByName(args[1]); // "255.255.255.0");
            InetAddress ip = InetAddress.getByName(args[2]); // "195.226.6.70");
            System.out.println(InetAddressUtil.contains(network, subnet, ip));
        } catch(Exception e) {
            System.err.println(e);
        }
    }
}

@@ -1,11 +1,12 @@
 /*%0A
+ 
 * Copyri
@@ -50,18 +50,20 @@
 ndation%0A
+ 
 *%0A
+ 
 * Licens
@@ -120,16 +120,17 @@
 ense%22);%0A
+ 
 * you ma
@@ -188,16 +188,17 @@
 icense.%0A
+ 
 * You ma
@@ -231,18 +231,20 @@
 ense at%0A
+ 
 *%0A
+ 
 *     ht
@@ -284,18 +284,20 @@
 NSE-2.0%0A
+ 
 *%0A
+ 
 * Unless
@@ -358,16 +358,17 @@
 oftware%0A
+ 
 * distri
@@ -427,16 +427,17 @@
  BASIS,%0A
+ 
 * WITHOU
@@ -503,16 +503,17 @@
 mplied.%0A
+ 
 * See th
@@ -574,16 +574,17 @@
 ons and%0A
+ 
 * limita
@@ -608,16 +608,17 @@
 icense.%0A
+ 
 */%0Apacka
@@ -671,16 +671,54 @@
 Address;
+%0Aimport java.net.UnknownHostException;
 %0A%0Aimport
@@ -831,20 +831,16 @@
 tCase %7B%0A
-    
 %0A    pub
@@ -870,26 +870,46 @@
 sUtil() 
-%7B%0A        
+throws UnknownHostException %7B%0A
 %0A       
@@ -982,17 +982,9 @@
  %7D;%0A
-        
 %0A
+
     
@@ -1126,26 +1126,8 @@
  %7D%0A%0A
-        try %7B%0A    
     
@@ -1204,36 +1204,32 @@
 6.64%22);%0A        
-   
- 
 InetAddress subn
@@ -1290,28 +1290,24 @@
 %22);%0A        
-    
 InetAddress 
@@ -1363,36 +1363,32 @@
 6.70%22);%0A        
- 
-   
 System.out.print
@@ -1442,84 +1442,8 @@
 ));%0A
-        %7D catch(Exception e) %7B%0A            System.err.println(e);%0A        %7D%0A
     

Throw exception instead of System.out when InetAddressUtilTest has errors