()
| 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(); |
nothing calls this directly
no test coverage detected