HdfFileChannel { public ByteBuffer map(long address, long length) { return mapNoOffset(address + sb.getBaseAddressByte(), length); } HdfFileChannel(FileChannel fileChannel, Superblock superblock); ByteBuffer readBufferFromAddress(long address, int length); ByteBuffer map(long address, long length); ByteBuffer mapNoOffset(long address, long length); long getUserBlockSize(); Superblock getSuperblock(); FileChannel getFileChannel(); int getSizeOfOffsets(); int getSizeOfLengths(); final void close(); long size();  }
@Test void testMap() throws IOException { MappedByteBuffer mockMappedByteBuffer = mock(MappedByteBuffer.class); when(fc.map(any(MapMode.class), anyLong(), anyLong())).thenReturn(mockMappedByteBuffer); assertThat(hdfFc.map(20, 10), is(sameInstance(mockMappedByteBuffer))); }
@Test void testMapThrows() throws IOException { when(fc.map(any(MapMode.class), anyLong(), anyLong())).thenThrow(IOException.class); assertThrows(HdfException.class, () -> hdfFc.map(20, 10)); }