- public void ipv4Tests() throws Exception {
- IpClass ipClass = new IpClass("1.2.3.4/16");
- assertEquals("1.2.3.4", UTIL.ipv4AddressFrom(ipClass).getValue());
- assertTrue(UTIL.ipv4PrefixFor(UTIL.ipv4AddressBytes(ipClass)).getValue().contains("/32"));
- ipClass = new IpClass("1.2.3.4");
- assertTrue(UTIL.ipv4PrefixFor(UTIL.inetAddressFor(ipClass)).getValue().contains("/32"));
- assertTrue(UTIL.ipv4PrefixFor(ipClass).getValue().contains("/32"));
- assertTrue(UTIL.ipv4PrefixFor(ipClass, 16).getValue().contains("/16"));
-
- assertTrue(UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 0).getValue().equals("0.0.0.0/0"));
- assertTrue(UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 32).getValue().equals("1.2.3.4/32"));
- assertTrue(UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 0, 0).getValue().equals("0.0.0.0/0"));
- assertTrue(UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 0, 32).getValue().equals("1.2.3.4/32"));
- assertTrue(UTIL.ipv4PrefixForShort(new byte[] { 1, 2, 3, 4, 5 }, 1, 32).getValue().equals("2.3.4.5/32"));
- assertTrue(UTIL.ipv4PrefixForShort(new byte[] { 1, 2, 3, 4, 5 }, 0, 1).getValue().equals("1.0.0.0/1"));
-
- assertTrue(UTIL.splitIpv4Prefix(new IpClass("1.2.3.4/16")).getKey().getValue().equals("1.2.3.4"));
- assertTrue(UTIL.splitIpv4Prefix(new IpClass("1.2.3.4/16")).getValue().equals(16));
+ public void ipv4Tests() {
+ assertEquals("1.2.3.4", UTIL.ipv4AddressFrom(new IpClass("1.2.3.4/16")).getValue());
+ final IpClass ipClass = new IpClass("1.2.3.4");
+ assertEquals("1.2.3.4/32", UTIL.ipv4PrefixFor(UTIL.ipv4AddressBytes(ipClass)).getValue());
+ assertEquals("1.2.3.4/32", UTIL.ipv4PrefixFor(UTIL.inetAddressFor(ipClass)).getValue());
+ assertEquals("1.2.3.4/32", UTIL.ipv4PrefixFor(ipClass).getValue());
+ assertEquals("1.2.3.4/16", UTIL.ipv4PrefixFor(ipClass, 16).getValue());
+
+ assertEquals("0.0.0.0/0", UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 0).getValue());
+ assertEquals("1.2.3.4/32", UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 32).getValue());
+ assertEquals("0.0.0.0/0", UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 0, 0).getValue());
+ assertEquals("1.2.3.4/32", UTIL.ipv4PrefixForShort(UTIL.ipv4AddressBytes(ipClass), 0, 32).getValue());
+ assertEquals("2.3.4.5/32", UTIL.ipv4PrefixForShort(new byte[] { 1, 2, 3, 4, 5 }, 1, 32).getValue());
+ assertEquals("1.0.0.0/1", UTIL.ipv4PrefixForShort(new byte[] { 1, 2, 3, 4, 5 }, 0, 1).getValue());
+
+ assertEquals("1.2.3.4", UTIL.splitIpv4Prefix(new IpClass("1.2.3.4/16")).getKey().getValue());
+ assertEquals((Integer) 16, UTIL.splitIpv4Prefix(new IpClass("1.2.3.4/16")).getValue());