FileSystemArchiveFile extends ArchiveFile { public File copyStreamToDirectory(String directory) throws IOException { FileUtils.copyFileToDirectory(filesDirectory + "/" + fileName, directory); return new File(directory + "/" + fileName); } FileSystemArchiveFile(String mimeType, String originalFixity, String fileName, String filesDirectory); InputStream toStream(); File copyStreamToDirectory(String directory); String generateFilePath();  }
@Test public void test_copy_stream_to_file() throws IOException { FileSystemArchiveFile fsaf = new FileSystemArchiveFile("mime", FIXITY, FILE_NAME, TEST_DIRECTORY); String tempDirectory = "src/test/resources/temp"; File tempFile = new File(tempDirectory + "/" + FILE_NAME); if (tempFile.exists()) tempFile.delete(); fsaf.copyStreamToDirectory(tempDirectory); assertThat(tempFile.exists(), is(true)); }