@Test public void deleteTempFile_should_not_crash_if_tempFile_is_null() { cut.deleteTempFile(new Response().withStream(new Stream())); }
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); } } }
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); } } } }
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); } } }  }
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); }
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; }