@@ -0,0 +1,1844 @@
+/**%0A * Copyright (C) 2010 the original author or authors.%0A * See the notice.md file distributed with this work for additional%0A * information regarding copyright ownership.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.beust.jcommander.converters;%0A%0Aimport java.net.InetAddress;%0Aimport java.net.UnknownHostException;%0A%0Aimport org.testng.Assert;%0Aimport org.testng.annotations.Test;%0A%0A@Test%0Apublic class InetAddressConverterTest %7B%0A%0A%09private static final InetAddressConverter INET_ADDRESS_CONVERTER = new InetAddressConverter();%0A%09private static final InetAddress LOOPBACK_ADDRESS = InetAddress.getLoopbackAddress();%0A%0A%09@Test%0A%09public void testLocalhost() throws UnknownHostException %7B%0A%09%09test(%22localhost%22);%0A%09%7D%0A%0A%09@Test%0A%09public void testLocalhostAddress() throws UnknownHostException %7B%0A%09%09test(%22127.0.0.1%22);%0A%09%7D%0A%0A%09@Test(expectedExceptions = IllegalArgumentException.class)%0A%09public void testGargabeInput() throws UnknownHostException %7B%0A%09%09test(%22!@#$%25%22);%0A%09%7D%0A%0A%09@Test%0A%09public void testEmptyInput() throws UnknownHostException %7B%0A%09%09test(%22%22);%0A%09%7D%0A%0A%09@Test(expectedExceptions = IllegalArgumentException.class)%0A%09public void testBlankInput() throws UnknownHostException %7B%0A%09%09test(%22   %22);%0A%09%7D%0A%0A%09private void test(String string) throws UnknownHostException %7B%0A%09%09Assert.assertEquals(INET_ADDRESS_CONVERTER.convert(string), LOOPBACK_ADDRESS);%0A%0A%09%7D%0A%7D%0A

Add unit test for InetAddressConverter.