### Question:
FileUtils { public static byte[] readAllBytes(java.nio.file.Path path) throws IOException { try (SeekableByteChannel channel = Files.newByteChannel(path); InputStream in = Channels.newInputStream(channel)) { long size = channel.size(); if (size > (long) MAX_BUFFER_SIZE) { throw new OutOfMemoryError("Required array size too large"); } return read(in, (int) size); } } private  FileUtils(); static void writeCompletely(WritableByteChannel channel, ByteBuffer src); static String getRandomFilename(final String prefix); static String readFile(File file, String charsetName); static String readFileUtf8(File file); static void writeFile(File file, String contents, String encoding); static void writeFileUtf8(File file, String contents); static byte[] readAllBytes(java.nio.file.Path path); static void deleteFileOrDirectory(File file); static void deleteDirectory(File directory); static void deleteDirectoryQuietly(File directory); static void cleanDirectory(File directory); static boolean deletePathIfEmpty(FileSystem fileSystem, Path path); static void copy(Path sourcePath, Path targetPath, boolean executable); static Path compressDirectory(Path directory, Path target); static Path expandDirectory(Path file, Path targetDirectory);  }### Answer:
@Test public void testReadAllBytes() throws Exception { TemporaryFolder tmpFolder = null; try { tmpFolder = new TemporaryFolder(new File(this.getClass().getResource("/").getPath())); tmpFolder.create(); final int fileSize = 1024; final String testFilePath = tmpFolder.getRoot().getAbsolutePath() + File.separator + this.getClass().getSimpleName() + "_" + fileSize + ".txt"; { String expectedMD5 = generateTestFile(testFilePath, 1024); final byte[] data = FileUtils.readAllBytes((new File(testFilePath)).toPath()); assertEquals(expectedMD5, md5Hex(data)); } { String expectedMD5 = generateTestFile(testFilePath, 4096); final byte[] data = FileUtils.readAllBytes((new File(testFilePath)).toPath()); assertEquals(expectedMD5, md5Hex(data)); } { String expectedMD5 = generateTestFile(testFilePath, 5120); final byte[] data = FileUtils.readAllBytes((new File(testFilePath)).toPath()); assertEquals(expectedMD5, md5Hex(data)); } } finally { if (tmpFolder != null) { tmpFolder.delete(); } } }