102 } 103 104 for (int i = 0; i < nodes.length; i++) { 105 if ((i & 1) == 0) { 106 assertEquals((Integer) i, map.get(nodes[i])); 107 } else { 108 assertEquals(null, map.get(nodes[i])); 109 } 110 } 111 } 112 113 @Test 114 public void testNewGet() { 115 /* 116 * Failing here is not required, but if this behavior changes, usages of get need to be 117 * checked for compatibility. 118 */ 119 TestNode newNode = graph.add(new TestNode()); 120 try { 121 map.get(newNode); 122 fail("expected " + (Assertions.ENABLED ? AssertionError.class.getSimpleName() : ArrayIndexOutOfBoundsException.class.getSimpleName())); 123 } catch (AssertionError ae) { 124 // thrown when assertions are enabled 125 } catch (ArrayIndexOutOfBoundsException e) { 126 // thrown when assertions are disabled 127 } 128 } 129 130 @Test 131 public void testNewSet() { 132 /* 133 * Failing here is not required, but if this behavior changes, usages of set need to be 134 * checked for compatibility. 135 */ 136 TestNode newNode = graph.add(new TestNode()); 137 try { 138 map.set(newNode, 1); 139 fail("expected " + (Assertions.ENABLED ? AssertionError.class.getSimpleName() : ArrayIndexOutOfBoundsException.class.getSimpleName())); 140 } catch (AssertionError ae) { 141 // thrown when assertions are enabled 142 } catch (ArrayIndexOutOfBoundsException e) { 143 // thrown when assertions are disabled 144 } 145 } 146 147 @Test 148 public void testNewGetAndGrow() { 149 TestNode newNode = graph.add(new TestNode()); 150 assertEquals(null, map.getAndGrow(newNode)); 151 } 152 153 @Test 154 public void testNewSetAndGrow() { 155 TestNode newNode = graph.add(new TestNode()); 156 map.setAndGrow(newNode, 1); 157 assertEquals((Integer) 1, map.get(newNode)); 158 } 159 } | 102 } 103 104 for (int i = 0; i < nodes.length; i++) { 105 if ((i & 1) == 0) { 106 assertEquals((Integer) i, map.get(nodes[i])); 107 } else { 108 assertEquals(null, map.get(nodes[i])); 109 } 110 } 111 } 112 113 @Test 114 public void testNewGet() { 115 /* 116 * Failing here is not required, but if this behavior changes, usages of get need to be 117 * checked for compatibility. 118 */ 119 TestNode newNode = graph.add(new TestNode()); 120 try { 121 map.get(newNode); 122 fail("expected " + (Assertions.assertionsEnabled() ? AssertionError.class.getSimpleName() : ArrayIndexOutOfBoundsException.class.getSimpleName())); 123 } catch (AssertionError ae) { 124 // thrown when assertions are enabled 125 } catch (ArrayIndexOutOfBoundsException e) { 126 // thrown when assertions are disabled 127 } 128 } 129 130 @Test 131 public void testNewSet() { 132 /* 133 * Failing here is not required, but if this behavior changes, usages of set need to be 134 * checked for compatibility. 135 */ 136 TestNode newNode = graph.add(new TestNode()); 137 try { 138 map.set(newNode, 1); 139 fail("expected " + (Assertions.assertionsEnabled() ? AssertionError.class.getSimpleName() : ArrayIndexOutOfBoundsException.class.getSimpleName())); 140 } catch (AssertionError ae) { 141 // thrown when assertions are enabled 142 } catch (ArrayIndexOutOfBoundsException e) { 143 // thrown when assertions are disabled 144 } 145 } 146 147 @Test 148 public void testNewGetAndGrow() { 149 TestNode newNode = graph.add(new TestNode()); 150 assertEquals(null, map.getAndGrow(newNode)); 151 } 152 153 @Test 154 public void testNewSetAndGrow() { 155 TestNode newNode = graph.add(new TestNode()); 156 map.setAndGrow(newNode, 1); 157 assertEquals((Integer) 1, map.get(newNode)); 158 } 159 } |