MCPcopy Create free account
hub / github.com/apache/poi / testGet

Method testGet

src/testcases/org/apache/poi/util/TestBinaryTree.java:155–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153 }
154
155 public void testGet() {
156 Map m = new BinaryTree();
157
158 try
159 {
160 m.get(new Object());
161 fail("should have caught ClassCastException");
162 }
163 catch (ClassCastException ignored)
164 {
165 }
166 try
167 {
168 m.get(null);
169 fail("should have caught NullPointerException");
170 }
171 catch (NullPointerException ignored)
172 {
173 }
174 assertNull(m.get("foo"));
175 LocalTestNode nodes[] = makeLocalNodes();
176
177 for (int k = 0; k < nodes.length; k++)
178 {
179 m.put(nodes[ k ].getKey(), nodes[ k ]);
180 assertSame(m.get(nodes[ k ].getKey()), nodes[ k ]);
181 }
182 assertNull(m.get(Integer.valueOf(-1)));
183 try
184 {
185 m.get("foo");
186 fail("Should have caught ClassCastException");
187 }
188 catch (ClassCastException ignored)
189 {
190 }
191 for (int k = 0; k < nodes.length; k++)
192 {
193 assertNotNull(m.get(nodes[ k ].getKey()));
194 m.remove(nodes[ k ].getKey());
195 assertNull(m.get(nodes[ k ].getKey()));
196 }
197 }
198
199 public void testPut() {
200 Map m = new BinaryTree();

Callers

nothing calls this directly

Calls 6

getMethod · 0.95
makeLocalNodesMethod · 0.95
putMethod · 0.95
removeMethod · 0.95
getKeyMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected