diff --git a/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingPropertiesToUserDefinedPOJOUnitTest.java b/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingPropertiesToUserDefinedPOJOUnitTest.java index 0c74d37bb6..44c4de01e4 100644 --- a/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingPropertiesToUserDefinedPOJOUnitTest.java +++ b/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingPropertiesToUserDefinedPOJOUnitTest.java @@ -1,6 +1,9 @@ package com.baeldung.boot.configurationproperties; import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Test; @@ -20,13 +23,17 @@ public class BindingPropertiesToUserDefinedPOJOUnitTest { assertEquals("node1", serverConfig.getName()); - assertEquals(Set.of("img1.jpg", "img2.jpg"), - serverConfig.getImgIds()); + Set expectedImgs = new HashSet<>(); + expectedImgs.add("img1.jpg"); + expectedImgs.add("img2.jpg"); + assertEquals(expectedImgs, serverConfig.getImgIds()); assertEquals("192.168.0.1", serverConfig.getAddress().getIp()); assertEquals(8099, serverConfig.getAddress().getPort()); - assertEquals(Map.of("imgs", "/root/imgs", "html", "/root/html"), - serverConfig.getDirs()); + Map expectedDirs = new HashMap<>(); + expectedDirs.put("imgs", "/root/imgs"); + expectedDirs.put("html", "/root/html"); + assertEquals(expectedDirs, serverConfig.getDirs()); } } \ No newline at end of file diff --git a/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingYMLPropertiesUnitTest.java b/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingYMLPropertiesUnitTest.java index 6d2d1d21e3..8f88eeca7e 100644 --- a/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingYMLPropertiesUnitTest.java +++ b/spring-boot-testing/src/test/java/com/baeldung/boot/configurationproperties/BindingYMLPropertiesUnitTest.java @@ -1,6 +1,9 @@ package com.baeldung.boot.configurationproperties; import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Test; @@ -18,13 +21,17 @@ public class BindingYMLPropertiesUnitTest { assertEquals("node2", serverConfig.getName()); - assertEquals(Set.of("img1.png", "img2.png"), - serverConfig.getImgIds()); + Set expectedImgs = new HashSet<>(); + expectedImgs.add("img1.png"); + expectedImgs.add("img2.png"); + assertEquals(expectedImgs, serverConfig.getImgIds()); assertEquals("192.168.0.2", serverConfig.getAddress().getIp()); assertEquals(5000, serverConfig.getAddress().getPort()); - assertEquals(Map.of("imgs", "/etc/imgs", "html", "/etc/html"), - serverConfig.getDirs()); + Map expectedDirs = new HashMap<>(); + expectedDirs.put("imgs", "/etc/imgs"); + expectedDirs.put("html", "/etc/html"); + assertEquals(expectedDirs, serverConfig.getDirs()); } } \ No newline at end of file