### Question:
StreamUtil { public static String toString(final InputStream in, final String encoding) throws IOException { return new String(streamToByteArray(in), encoding); }  static String toString(final InputStream in, final String encoding); static byte[] streamToByteArray(final InputStream in); static InputStream copyStream(final InputStream in); static void copy(final InputStream input, final OutputStream output);  }### Answer:
@Test public void shouldReadToString() throws IOException { final InputStream is = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8)); assertThat("foo").isEqualTo(StreamUtil.toString(is, "UTF-8")); }