### Question:
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; }### Answer:
@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(); }
@Test public void appendResponseBody_should_append_error_message_when_file_read_error() { StringBuilder html = new StringBuilder(); Stream stream = new Stream().withTempFile(new File("nonexistent")); cut.appendResponseBody(html, stream, "any"); assertThat(html.toString()).startsWith("<pre>Error in ARA while reading the content of the response received by Newman:\n" + "java.io.FileNotFoundException: File"); assertThat(html.toString()).endsWith("</pre>\n"); }