String instantiation is not needed

Removed a String instntiation, test case added

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
This commit is contained in:
Laszlo Hornyak 2013-06-08 21:39:52 +02:00 committed by Chip Childers
parent ce8ada030d
commit 564013bec0
2 changed files with 6 additions and 1 deletions

View File

@ -257,7 +257,7 @@ public class NetUtils {
return ipFromInetAddress(addr);
}
return new String("127.0.0.1");
return "127.0.0.1";
}
public static String ipFromInetAddress(InetAddress addr) {

View File

@ -168,4 +168,9 @@ public class NetUtilsTest extends TestCase {
newMac = NetUtils.generateMacOnIncrease(mac, 16);
assertTrue(newMac.equals("06:00:0f:00:45:67"));
}
@Test
public void testGetLocalIPString() {
assertNotNull(NetUtils.getLocalIPString());
}
}