UploadManager { public boolean deleteKeyStore(final String keyStoreFile) { return deleteFile(keyStoreFile, keyStoreUploadPath); } UploadManager(final String uploadPath); String handleDeserializerUpload(final MultipartFile file, final String outFileName); String handleFilterUpload(final MultipartFile file, final String outFileName); String handleKeystoreUpload(final MultipartFile file, final String outFileName); boolean deleteKeyStore(final String keyStoreFile);  }
@Test public void testDeleteNullFile() throws IOException { final Path tempDirectory = Files.createTempDirectory(null); final UploadManager uploadManager = new UploadManager(tempDirectory.toString()); final boolean result = uploadManager.deleteKeyStore(null); assertTrue("Gracefully returns true", result); assertTrue("Temp dir still exists", tempDirectory.toFile().exists()); }
@Test public void testDeleteNonExistantFile() throws IOException { final Path tempDirectory = Files.createTempDirectory(null); final UploadManager uploadManager = new UploadManager(tempDirectory.toString()); final boolean result = uploadManager.deleteKeyStore("This-File-Does-not-exist"); assertTrue("Gracefully returns true", result); }
@Test public void testDeleteEmptyFile() throws IOException { final Path tempDirectory = Files.createTempDirectory(null); final UploadManager uploadManager = new UploadManager(tempDirectory.toString()); final boolean result = uploadManager.deleteKeyStore(""); assertTrue("Gracefully returns true", result); assertTrue("Temp dir still exists", tempDirectory.toFile().exists()); }