This commit is contained in:
Looly
2022-03-03 21:52:30 +08:00
parent 4c1a729e97
commit d1dea5c88e
5 changed files with 39 additions and 33 deletions

View File

@@ -26,6 +26,24 @@ public class MapUtilTest {
Assert.assertEquals("4", map2.get("d"));
}
@Test
public void filterMapWrapperTest() {
Map<String, String> map = MapUtil.newHashMap();
map.put("a", "1");
map.put("b", "2");
map.put("c", "3");
map.put("d", "4");
final Map<String, String> camelCaseMap = MapUtil.toCamelCaseMap(map);
Map<String, String> map2 = MapUtil.filter(camelCaseMap, t -> Convert.toInt(t.getValue()) % 2 == 0);
Assert.assertEquals(2, map2.size());
Assert.assertEquals("2", map2.get("b"));
Assert.assertEquals("4", map2.get("d"));
}
@Test
public void filterContainsTest() {
Map<String, String> map = MapUtil.newHashMap();