Using java7 syntax for Map and Set
This commit is contained in:
parent
cc283b4233
commit
5b245cde28
|
@ -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<String> 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<String, String> expectedDirs = new HashMap<>();
|
||||
expectedDirs.put("imgs", "/root/imgs");
|
||||
expectedDirs.put("html", "/root/html");
|
||||
assertEquals(expectedDirs, serverConfig.getDirs());
|
||||
}
|
||||
}
|
|
@ -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<String> 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<String, String> expectedDirs = new HashMap<>();
|
||||
expectedDirs.put("imgs", "/etc/imgs");
|
||||
expectedDirs.put("html", "/etc/html");
|
||||
assertEquals(expectedDirs, serverConfig.getDirs());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue