GlobalHeap { public ByteBuffer getObjectData(int index) { if (!objects.containsKey(index)) { throw new IllegalArgumentException("Global heap doesn't contain object with index: " + index); } return objects.get(index).data.slice(); } GlobalHeap(HdfFileChannel hdfFc, long address); @Override String toString(); ByteBuffer getObjectData(int index); int getObjectReferenceCount(int index);  }
@Test void testGettingObjectOutOfRangeThrows() { assertThrows(IllegalArgumentException.class, () -> globalHeap.getObjectData(5)); }