Skip to content

Commit 2b5bfd2

Browse files
committed
Fix test naming
The toIp tests with null / empty string are still valid Referring to docs from InetAddress.getByName() "If the host is null or host.length() is equal to zero, then an InetAddress representing an address of the loopback interface is returned."
1 parent 5c3ee2b commit 2b5bfd2

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/CefProcessorTests.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,36 +1044,24 @@ public void testEUI64ToMacAddressWithOutSeparators() {
10441044
assertEquals("00:0D:60:FF:FE:AF:1B:61", result);
10451045
}
10461046

1047-
public void toIP_validIPv4Address() {
1047+
public void testtoIPValidIPv4Address() {
10481048
CefParser parser = new CefParser(ZoneId.of("UTC"), true);
10491049
String result = parser.toIP("192.168.1.1");
10501050
assertEquals("192.168.1.1", result);
10511051
}
10521052

1053-
public void toIP_validIPv6Address() {
1053+
public void testToIPValidIPv6Address() {
10541054
CefParser parser = new CefParser(ZoneId.of("UTC"), true);
10551055
String result = parser.toIP("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
10561056
assertEquals("2001:db8:85a3::8a2e:370:7334", result);
10571057
}
10581058

1059-
public void toIP_invalidIPAddress() {
1059+
public void testToIPInvalidIPAddress() {
10601060
CefParser parser = new CefParser(ZoneId.of("UTC"), true);
10611061
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> parser.toIP("invalid_ip"));
10621062
assertEquals("Invalid IP address format", exception.getMessage());
10631063
}
10641064

1065-
public void toIP_emptyString() {
1066-
CefParser parser = new CefParser(ZoneId.of("UTC"), true);
1067-
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> parser.toIP(""));
1068-
assertEquals("Invalid IP address format", exception.getMessage());
1069-
}
1070-
1071-
public void toIP_nullString() {
1072-
CefParser parser = new CefParser(ZoneId.of("UTC"), true);
1073-
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> parser.toIP(null));
1074-
assertEquals("Invalid IP address format", exception.getMessage());
1075-
}
1076-
10771065
private static void assertMapsEqual(Map<?, ?> actual, Map<?, ?> expected) {
10781066
innerAssertMapsEqual(actual, expected, "");
10791067
}

0 commit comments

Comments
 (0)