@Test public void testCopyFromString() throws IOException { String content = "content"; StringWriter out = new StringWriter(); copy(content, out); assertThat(out.toString(), equalTo(content)); }
@Test public void testCopyFromReader() throws IOException { String content = "content"; StringReader in = new StringReader(content); StringWriter out = new StringWriter(); int count = copy(in, out); assertThat(content.length(), equalTo(count)); assertThat(out.toString(), equalTo(content)); }