### Question:
AddressSetMapping { public Address getAddress(int index) { if (index < 0 || index >= maxIndex) { return null; } if (!indexInCurrentRange(index)) { setCurrentRange(index); } return getAddress(currentRange, index - currentRangeStart); } AddressSetMapping(AddressSetView set); Address getAddress(int index);  }### Answer:
@Test public void testStart() { assertEquals(addr(10), mapping.getAddress(0)); }
@Test public void testEnd() { assertEquals(addr(79), mapping.getAddress(39)); }
@Test public void testBadIndexes() { assertNull(mapping.getAddress(-1)); assertNull(mapping.getAddress(40)); }
@Test public void testSequentialAccess() { AddressIterator addressIterator = set.getAddresses(true); for (int i = 0; i < 40; i++) { assertEquals(addressIterator.next(), mapping.getAddress(i)); } }
@Test public void testRandomAccess() { assertEquals(addr(50), mapping.getAddress(20)); assertEquals(addr(10), mapping.getAddress(0)); assertEquals(addr(59), mapping.getAddress(29)); assertEquals(addr(35), mapping.getAddress(15)); }