### Question:
MarkdownPrinter { public void print(InputStream stream) { System.out.print("Input markdown: "); try { String markdown = StreamUtils.copyToString(stream, StandardCharsets.UTF_8); for (int i = 0; i < 3; i++) { String html = this.renderer.render(markdown); System.out.println("TrackId = " + trackId.asLong()); System.out.println(html); } } catch (IOException e) { throw new UncheckedIOException(e); } } MarkdownPrinter(MarkdownRenderer renderer, TrackId trackId); void print(InputStream stream);  }### Answer:
@Test void print(CapturedOutput capture) { MarkdownRenderer markdownRenderer = Mockito.mock(MarkdownRenderer.class); given(markdownRenderer.render(anyString())).willReturn("<p>Markdown!</p>"); MarkdownPrinter printer = new MarkdownPrinter(markdownRenderer, new TrackId()); InputStream stream = new ByteArrayInputStream( "Markdown!".getBytes(StandardCharsets.UTF_8)); printer.print(stream); assertThat(capture.toString()).contains("Input markdown:"); assertThat(capture.toString()).contains("<p>Markdown!</p>"); }