HdfFileChannel { public long size() { try { return fc.size(); } catch (IOException e) { throw new HdfException("Failed to get size of HDF5 file", e); } } 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 testSize() throws IOException { when(fc.size()).thenReturn(12345L); assertThat(hdfFc.size(), is(equalTo(12345L))); }
@Test void testSizeThrows() throws IOException { when(fc.size()).thenThrow(IOException.class); assertThrows(HdfException.class, () -> hdfFc.size()); }