33import static org .junit .jupiter .api .Assertions .assertEquals ;
44import static org .junit .jupiter .api .Assertions .assertThrows ;
55
6- import org .junit .jupiter .api .Test ;
7-
86import java .net .UnknownHostException ;
7+ import org .junit .jupiter .api .Test ;
98
109public class IPv6ConverterTest {
1110
@@ -20,40 +19,30 @@ public void testIpv4ToIpv6_ValidInput() throws UnknownHostException {
2019 @ Test
2120 public void testIpv6ToIpv4_InvalidIPv6MappedAddress () {
2221 String invalidIpv6 = "2001:db8::1" ; // Not an IPv6-mapped IPv4
23- assertThrows (IllegalArgumentException .class , () -> {
24- IPv6Converter .ipv6ToIpv4 (invalidIpv6 );
25- });
22+ assertThrows (IllegalArgumentException .class , () -> { IPv6Converter .ipv6ToIpv4 (invalidIpv6 ); });
2623 }
2724
2825 @ Test
2926 public void testIpv4ToIpv6_InvalidIPv4Address () {
3027 String invalidIpv4 = "999.999.999.999" ; // Invalid IPv4 address
31- assertThrows (UnknownHostException .class , () -> {
32- IPv6Converter .ipv4ToIpv6 (invalidIpv4 );
33- });
28+ assertThrows (UnknownHostException .class , () -> { IPv6Converter .ipv4ToIpv6 (invalidIpv4 ); });
3429 }
3530
3631 @ Test
3732 public void testIpv6ToIpv4_InvalidFormat () {
3833 String invalidIpv6 = "invalid:ipv6::address" ;
39- assertThrows (UnknownHostException .class , () -> {
40- IPv6Converter .ipv6ToIpv4 (invalidIpv6 );
41- });
34+ assertThrows (UnknownHostException .class , () -> { IPv6Converter .ipv6ToIpv4 (invalidIpv6 ); });
4235 }
4336
4437 @ Test
4538 public void testIpv4ToIpv6_EmptyString () {
4639 String emptyIpv4 = "" ;
47- assertThrows (UnknownHostException .class , () -> {
48- IPv6Converter .ipv4ToIpv6 (emptyIpv4 );
49- });
40+ assertThrows (UnknownHostException .class , () -> { IPv6Converter .ipv4ToIpv6 (emptyIpv4 ); });
5041 }
5142
5243 @ Test
5344 public void testIpv6ToIpv4_EmptyString () {
5445 String emptyIpv6 = "" ;
55- assertThrows (IllegalArgumentException .class , () -> {
56- IPv6Converter .ipv6ToIpv4 (emptyIpv6 );
57- });
46+ assertThrows (IllegalArgumentException .class , () -> { IPv6Converter .ipv6ToIpv4 (emptyIpv6 ); });
5847 }
5948}
0 commit comments