### Question:
StringUtil { public static String convertStreamToUTF8String(final InputStream is) throws IOException { return convertStreamToString(is, Charset.forName(UTF_8)); } private  StringUtil(); static boolean isNullOrEmpty(final String string); static boolean isBlank(final String string); static String convertStreamToString(final InputStream is, final Charset charset); static String convertStreamToUTF8String(final InputStream is); static String clipString(final String input, final int numChars, final boolean appendEllipses); static String convertArrayToString(final String[] stringArr); static String convertSetToString(final Set<String> stringSet); static String trimOrPadString(String str, int len, final char pad); static final String UTF_8; }### Answer:
@Test public void convertStreamToString_test() throws IOException { String text = "soijweoirj2k3kllsfl"; ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes()); assertEquals(text + "\n", StringUtil.convertStreamToUTF8String(stream)); }
@Test public void convertStreamToString_multiple_lines_test() throws IOException { String text = "soijweoirj2k3kllsfl\n2932kljldfjoi2\n"; ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes()); assertEquals(text, StringUtil.convertStreamToUTF8String(stream)); }