mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 10:49:39 +02:00
Add MultiMap.flatten()
This commit is contained in:
parent
41d734f2db
commit
324302c536
2 changed files with 34 additions and 0 deletions
|
@ -14,6 +14,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -156,4 +158,23 @@ public class MultiMapTest {
|
|||
assertFalse(map.containsKey("foo"));
|
||||
assertTrue(map.containsKey("bingo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flattenEmptyMap() {
|
||||
MultiMap<String, String> empty = new MultiMap<>();
|
||||
assertEquals(Collections.emptySet(), empty.flatten());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flattenMap() {
|
||||
MultiMap<String, String> map = new MultiMap<>();
|
||||
map.put("A", "1");
|
||||
map.put("A", "2");
|
||||
map.put("B", "1");
|
||||
|
||||
Set<String> expected = new LinkedHashSet<>();
|
||||
expected.add("1");
|
||||
expected.add("2");
|
||||
assertEquals(expected, map.flatten());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue