Pavlin Radoslavov

Minor refactoring (for code consistency).

No functional changes.
......@@ -136,18 +136,19 @@ public class Ip4AddressTest {
@Test
public void testValueOfByteArrayIPv4() {
Ip4Address ipAddress;
byte[] value;
final byte[] value1 = new byte[] {1, 2, 3, 4};
ipAddress = Ip4Address.valueOf(value1);
value = new byte[] {1, 2, 3, 4};
ipAddress = Ip4Address.valueOf(value);
assertThat(ipAddress.toString(), is("1.2.3.4"));
final byte[] value2 = new byte[] {0, 0, 0, 0};
ipAddress = Ip4Address.valueOf(value2);
value = new byte[] {0, 0, 0, 0};
ipAddress = Ip4Address.valueOf(value);
assertThat(ipAddress.toString(), is("0.0.0.0"));
final byte[] value3 = new byte[] {(byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff};
ipAddress = Ip4Address.valueOf(value3);
value = new byte[] {(byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff};
ipAddress = Ip4Address.valueOf(value);
assertThat(ipAddress.toString(), is("255.255.255.255"));
}
......@@ -157,9 +158,10 @@ public class Ip4AddressTest {
@Test(expected = NullPointerException.class)
public void testInvalidValueOfNullArrayIPv4() {
Ip4Address ipAddress;
byte[] value;
final byte[] fromArray = null;
ipAddress = Ip4Address.valueOf(fromArray);
value = null;
ipAddress = Ip4Address.valueOf(value);
}
/**
......@@ -169,9 +171,10 @@ public class Ip4AddressTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidValueOfShortArrayIPv4() {
Ip4Address ipAddress;
byte[] value;
final byte[] fromArray = new byte[] {1, 2, 3};
ipAddress = Ip4Address.valueOf(fromArray);
value = new byte[] {1, 2, 3};
ipAddress = Ip4Address.valueOf(value);
}
/**
......
......@@ -154,9 +154,10 @@ public class Ip6AddressTest {
@Test(expected = NullPointerException.class)
public void testInvalidValueOfNullArrayIPv6() {
Ip6Address ipAddress;
byte[] value;
final byte[] fromArray = null;
ipAddress = Ip6Address.valueOf(fromArray);
value = null;
ipAddress = Ip6Address.valueOf(value);
}
/**
......@@ -166,9 +167,10 @@ public class Ip6AddressTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidValueOfShortArrayIPv6() {
Ip6Address ipAddress;
byte[] value;
final byte[] fromArray = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
ipAddress = Ip6Address.valueOf(fromArray);
value = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
ipAddress = Ip6Address.valueOf(value);
}
/**
......
......@@ -234,9 +234,10 @@ public class IpAddressTest {
@Test(expected = NullPointerException.class)
public void testInvalidValueOfNullArrayIPv4() {
IpAddress ipAddress;
byte[] value;
final byte[] fromArray = null;
ipAddress = IpAddress.valueOf(IpAddress.Version.INET, fromArray);
value = null;
ipAddress = IpAddress.valueOf(IpAddress.Version.INET, value);
}
/**
......@@ -245,9 +246,10 @@ public class IpAddressTest {
@Test(expected = NullPointerException.class)
public void testInvalidValueOfNullArrayIPv6() {
IpAddress ipAddress;
byte[] value;
final byte[] fromArray = null;
ipAddress = IpAddress.valueOf(IpAddress.Version.INET6, fromArray);
value = null;
ipAddress = IpAddress.valueOf(IpAddress.Version.INET6, value);
}
/**
......@@ -257,9 +259,10 @@ public class IpAddressTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidValueOfShortArrayIPv4() {
IpAddress ipAddress;
byte[] value;
final byte[] fromArray = new byte[] {1, 2, 3};
ipAddress = IpAddress.valueOf(IpAddress.Version.INET, fromArray);
value = new byte[] {1, 2, 3};
ipAddress = IpAddress.valueOf(IpAddress.Version.INET, value);
}
/**
......@@ -269,9 +272,10 @@ public class IpAddressTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidValueOfShortArrayIPv6() {
IpAddress ipAddress;
byte[] value;
final byte[] fromArray = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
ipAddress = IpAddress.valueOf(IpAddress.Version.INET6, fromArray);
value = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
ipAddress = IpAddress.valueOf(IpAddress.Version.INET6, value);
}
/**
......