@Test public void appendResponseBody_should_append_nothing_when_null_stream_file() { StringBuilder html = new StringBuilder(); cut.appendResponseBody(html, new Stream(), "any"); assertThat(html.toString()).isEmpty(); }
void appendResponseBody(StringBuilder html, Stream stream, String contentType) { if (stream.getTempFile() != null) { String fileContent; try { fileContent = FileUtils.readFileToString(stream.getTempFile(), StandardCharsets.UTF_8); fileContent = prettyPrint(fileContent, contentType); } catch (IOException e) { log.error("Cannot read temporary file {}", stream.getTempFile(), e); fileContent = "Error in ARA while reading the content of the response received by Newman:\n" + ExceptionUtils.getStackTrace(e); } html.append("<pre>").append(escapeHtml(fileContent)).append("</pre>\n"); } }
PostmanService { void appendResponseBody(StringBuilder html, Stream stream, String contentType) { if (stream.getTempFile() != null) { String fileContent; try { fileContent = FileUtils.readFileToString(stream.getTempFile(), StandardCharsets.UTF_8); fileContent = prettyPrint(fileContent, contentType); } catch (IOException e) { log.error("Cannot read temporary file {}", stream.getTempFile(), e); fileContent = "Error in ARA while reading the content of the response received by Newman:\n" + ExceptionUtils.getStackTrace(e); } html.append("<pre>").append(escapeHtml(fileContent)).append("</pre>\n"); } } }
PostmanService { void appendResponseBody(StringBuilder html, Stream stream, String contentType) { if (stream.getTempFile() != null) { String fileContent; try { fileContent = FileUtils.readFileToString(stream.getTempFile(), StandardCharsets.UTF_8); fileContent = prettyPrint(fileContent, contentType); } catch (IOException e) { log.error("Cannot read temporary file {}", stream.getTempFile(), e); fileContent = "Error in ARA while reading the content of the response received by Newman:\n" + ExceptionUtils.getStackTrace(e); } html.append("<pre>").append(escapeHtml(fileContent)).append("</pre>\n"); } }  }
PostmanService { void appendResponseBody(StringBuilder html, Stream stream, String contentType) { if (stream.getTempFile() != null) { String fileContent; try { fileContent = FileUtils.readFileToString(stream.getTempFile(), StandardCharsets.UTF_8); fileContent = prettyPrint(fileContent, contentType); } catch (IOException e) { log.error("Cannot read temporary file {}", stream.getTempFile(), e); fileContent = "Error in ARA while reading the content of the response received by Newman:\n" + ExceptionUtils.getStackTrace(e); } html.append("<pre>").append(escapeHtml(fileContent)).append("</pre>\n"); } }  void parse(JsonParser parser, NewmanParsingResult result); List<ExecutedScenario> postProcess(Run run, NewmanParsingResult result, String newmanReportPath, AtomicInteger requestPosition); void deleteTempFiles(NewmanParsingResult newmanParsingResult); }
PostmanService { void appendResponseBody(StringBuilder html, Stream stream, String contentType) { if (stream.getTempFile() != null) { String fileContent; try { fileContent = FileUtils.readFileToString(stream.getTempFile(), StandardCharsets.UTF_8); fileContent = prettyPrint(fileContent, contentType); } catch (IOException e) { log.error("Cannot read temporary file {}", stream.getTempFile(), e); fileContent = "Error in ARA while reading the content of the response received by Newman:\n" + ExceptionUtils.getStackTrace(e); } html.append("<pre>").append(escapeHtml(fileContent)).append("</pre>\n"); } }  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; }