### Question:
PostmanService { void deleteTempFile(Response response) { if (response != null && response.getStream() != null) { Stream stream = response.getStream(); final File tempFile = stream.getTempFile(); if (tempFile != null) { try { Files.delete(Paths.get(tempFile.getPath())); } catch (IOException e) { log.error("Cannot delete temporary file {}", tempFile, e); } stream.setTempFile(null); } } }  void parse(JsonParser parser, NewmanParsingResult result); List<ExecutedScenario> postProcess(Run run, NewmanParsingResult result, String newmanReportPath, AtomicInteger requestPosition); void deleteTempFiles(NewmanParsingResult newmanParsingResult); static final String FOLDER_DELIMITER; }### Answer:
@Test public void deleteTempFile_should_not_crash_if_response_is_null() { cut.deleteTempFile(null); }
@Test public void deleteTempFile_should_not_crash_if_response_stream_is_null() { cut.deleteTempFile(new Response()); }
@Test public void deleteTempFile_should_not_crash_if_tempFile_is_null() { cut.deleteTempFile(new Response().withStream(new Stream())); }
@Test public void deleteTempFile_should_delete_the_temporary_file_and_set_it_to_null() throws IOException { File tempFile = File.createTempFile("ara_temp_unit_test_file_", ".bin"); tempFile.deleteOnExit(); Response response = new Response().withStream(new Stream().withTempFile(tempFile)); try { cut.deleteTempFile(response); assertThat(tempFile.exists()).isFalse(); assertThat(response.getStream().getTempFile()).isNull(); } finally { FileUtils.deleteQuietly(tempFile); } }