summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-07-02 18:09:58 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2022-07-02 18:09:58 +0200
commitded7c8099aabefd203ab89670dbf853f135e8f54 (patch)
treea49d57d12a50933145aedeca691ca56fa9ec2db1 /container-search
parent8934b4c48616352468124fd22227f4668a0f3706 (diff)
Test keySet
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/ChainedMapTestCase.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/ChainedMapTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/ChainedMapTestCase.java
index 87459c22d47..22847772ff3 100644
--- a/container-search/src/test/java/com/yahoo/search/query/profile/ChainedMapTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/ChainedMapTestCase.java
@@ -4,6 +4,7 @@ package com.yahoo.search.query.profile;
import org.junit.Test;
import java.util.Map;
+import java.util.Set;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -50,4 +51,16 @@ public class ChainedMapTestCase {
assertEquals("a_2", ab_a.get("a"));
assertEquals("b_2", ab_a.get("b"));
}
+
+ @Test
+ public void testKeySet() {
+ assertTrue(new ChainedMap<String, String>(Map.of(), Map.of()).keySet().isEmpty());
+ Map<String, String> a = Map.of("a", "a_1");
+ Map<String, String> b = Map.of("b", "b_1");
+ Map<String, String> ab = Map.of("a", "a_2", "b", "b_2");
+ assertEquals(Set.of("a"), new ChainedMap<>(a, Map.of()).keySet());
+ assertEquals(Set.of("a"), new ChainedMap<>(Map.of(), a).keySet());
+ assertEquals(Set.of("a", "b"), new ChainedMap<>(a, b).keySet());
+ assertEquals(Set.of("a", "b"), new ChainedMap<>(ab, b).keySet());
+ }
}