()
| 30 | public final class TestBinaryTree extends TestCase { |
| 31 | |
| 32 | public void testSize() { |
| 33 | Map m = new BinaryTree(); |
| 34 | |
| 35 | assertEquals(0, m.size()); |
| 36 | LocalTestNode nodes[] = makeLocalNodes(); |
| 37 | |
| 38 | for (int k = 0; k < nodes.length; k++) |
| 39 | { |
| 40 | m.put(nodes[ k ].getKey(), nodes[ k ].getValue()); |
| 41 | assertEquals(k + 1, m.size()); |
| 42 | } |
| 43 | int count = m.size(); |
| 44 | |
| 45 | for (int k = 0; k < nodes.length; k++) |
| 46 | { |
| 47 | m.remove(nodes[ k ].getKey()); |
| 48 | --count; |
| 49 | assertEquals(count, m.size()); |
| 50 | |
| 51 | // failed remove should not affect size |
| 52 | m.remove(nodes[ k ].getKey()); |
| 53 | assertEquals(count, m.size()); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | public void testIsEmpty() { |
| 58 | Map m = new BinaryTree(); |
nothing calls this directly
no test coverage detected