public void testGet() { assertEquals(FOO, tuple.get(0)); assertEquals(BAR, tuple.get(1)); try { tuple.get(-1); fail("Should have thrown IndexOutOfBoundsException when accessing index -1."); } catch (ArrayIndexOutOfBoundsException e) { // Expected. } try { tuple.get(2); fail("Should have thrown IndexOutOfBoundsException when accessing index that is greater " + "than the size of the tuple."); } catch (ArrayIndexOutOfBoundsException e) { // Expected. } }
public void testGet() { assertEquals(FOO, tuple.get(0)); assertEquals(BAR, tuple.get(1)); try { tuple.get(-1); fail("Should have thrown IndexOutOfBoundsException when accessing index -1."); } catch (ArrayIndexOutOfBoundsException e) { // Expected. } try { tuple.get(2); fail("Should have thrown IndexOutOfBoundsException when accessing index that is greater " + "than the size of the tuple."); } catch (ArrayIndexOutOfBoundsException e) { // Expected. } }