MCPcopy Create free account
hub / github.com/PCGen/pcgen / testGetKeySet

Method testGetKeySet

code/src/utest/pcgen/cdom/util/MapKeyMapTest.java:152–170  ·  view source on GitHub ↗

Test retrieval of the primary key set and that the retrieved set is not a pointer to the master set in the MapKeyMap.

()

Source from the content-addressed store, hash-verified

150 * not a pointer to the master set in the MapKeyMap.
151 */
152 @Test
153 public void testGetKeySet()
154 {
155 Set<MapKey<?, ?>> keySet = mapKeyMap.getKeySet();
156
157 assertEquals(1, keySet.size(), "only one primary key");
158 assertEquals(MapKey.ASPECT, keySet
159 .toArray()[0], "Only element should be an aspect");
160
161 mapKeyMap.addToMapFor(MapKey.PROPERTY, "foo", "bar");
162 assertEquals(
163 1, keySet.size(), "Still only one primary key, returned set should be independant of main collection");
164 assertFalse(keySet.contains(MapKey.PROPERTY), "Set should not include test yet");
165
166 keySet = mapKeyMap.getKeySet();
167 assertEquals(2, keySet.size(), "Now two primary keys");
168 assertTrue(keySet.contains(MapKey.ASPECT), "Set should include aspect");
169 assertTrue(keySet.contains(MapKey.PROPERTY), "Set should include test");
170 }
171
172 /**
173 * Test the containsMapFor method and the effect of adding and

Callers

nothing calls this directly

Calls 5

getKeySetMethod · 0.65
sizeMethod · 0.65
containsMethod · 0.65
toArrayMethod · 0.45
addToMapForMethod · 0.45

Tested by

no test coverage detected