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

Method testPut

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

Source from the content-addressed store, hash-verified

197 }
198
199 public void testPut() {
200 Map m = new BinaryTree();
201
202 try
203 {
204 m.put(new Object(), "foo");
205 fail("should have caught ClassCastException");
206 }
207 catch (ClassCastException ignored)
208 {
209 }
210 try
211 {
212 m.put(null, "foo");
213 fail("should have caught NullPointerException");
214 }
215 catch (NullPointerException ignored)
216 {
217 }
218 try
219 {
220 m.put("foo", null);
221 fail("should have caught NullPointerException");
222 }
223 catch (NullPointerException ignored)
224 {
225 }
226 try
227 {
228 m.put("foo", new Object());
229 fail("should have caught ClassCastException");
230 }
231 catch (ClassCastException ignored)
232 {
233 }
234 LocalTestNode[] nodes = makeLocalNodes();
235
236 for (int k = 0; k < nodes.length; k++)
237 {
238 assertNull(m.put(nodes[ k ].getKey(), nodes[ k ].getValue()));
239 try
240 {
241 m.put(nodes[ k ].getKey(), "foo");
242 }
243 catch (IllegalArgumentException ignored)
244 {
245 }
246 }
247 }
248
249 public void testRemove() {
250 BinaryTree m = new BinaryTree();

Callers

nothing calls this directly

Calls 4

putMethod · 0.95
makeLocalNodesMethod · 0.95
getValueMethod · 0.65
getKeyMethod · 0.45

Tested by

no test coverage detected