### Question:
FileManager { public InputStream newInputStream(final String filepath) throws FileNotFoundException { final File file = new File(directory, filepath); return newInputStream(file); } FileManager(final File rootDirectory); File createDirectory(final String directoryPath); File getDirectory(final String directoryPath); Set<File> listFilesInDirectory(final String directoryPath); Set<File> listFilesInDirectory(final File direc); File createFile(final String filepath); File createFile(final File file); boolean deleteFile(final String filepath); boolean deleteFile(final File file); InputStream newInputStream(final String filepath); InputStream newInputStream(final File file); OutputStream newOutputStream(final String filepath, final boolean append); OutputStream newOutputStream(final File file, final boolean append);  }### Answer:
@Test public void testNewInputStreamFromFile() throws IOException { File file = new File(ROOT_DIRECTORY, FILE_PATH); assertFalse(file.exists()); file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); fos.write(5); fos.flush(); fos.close(); InputStream is = fileManager.newInputStream(file); assertEquals(is.read(), 5); assertEquals(is.read(), -1); is.close(); }
@Test public void testNewInputStreamFromPath() throws IOException { File file = new File(ROOT_DIRECTORY, FILE_PATH); assertFalse(file.exists()); file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); fos.write(5); fos.flush(); fos.close(); InputStream is = fileManager.newInputStream(FILE_PATH); assertEquals(is.read(), 5); assertEquals(is.read(), -1); is.close(); }