### Question:
Streams { @Deprecated public static InputStream wrapString(String str) { return wrapString(str, Charset.defaultCharset()); } private  Streams(); @Deprecated static InputStream wrapString(String str); static InputStream wrapString(String str, Charset charset); @Deprecated static String readAll(final InputStream inputStream); static String readAll(final InputStream inputStream, Charset charset); @Deprecated static void write(String str, final OutputStream outputStream); static void write(String str, final OutputStream outputStream, Charset charset); static void copy(final InputStream inputStream, final OutputStream outputStream);  }### Answer:
@SuppressWarnings({"javadoc", "deprecation"}) @Test public void testWrapString() throws Exception { String testString = "Testing©ÿ»"; final InputStream inputStream = Streams.wrapString(testString); byte[] stringBytes = testString.getBytes(Charset.defaultCharset()); stringBytes = Arrays.copyOf(stringBytes, stringBytes.length); assertTrue("Streams should be equal", Arrays.equals(stringBytes, ByteStreams.toByteArray(inputStream))); }
@Test public void testWrapString_wrongCharset() throws Exception { String testString = "Testing©ÿ»"; final InputStream inputStream = Streams.wrapString(testString, Charset.forName(UTF_8)); byte[] stringBytes = testString.getBytes(Charset.forName(ISO_8859_1)); stringBytes = Arrays.copyOf(stringBytes, stringBytes.length); assertFalse("Streams should not be equal", Arrays.equals(stringBytes, ByteStreams.toByteArray(inputStream))); }
@Test public void testWrapString_sameCharset() throws Exception { String testString = "Testing©ÿ»"; final InputStream inputStream = Streams.wrapString(testString, Charset.forName(UTF_8)); byte[] stringBytes = testString.getBytes(Charset.forName(UTF_8)); stringBytes = Arrays.copyOf(stringBytes, stringBytes.length); assertTrue("Streams should be equal", Arrays.equals(stringBytes, ByteStreams.toByteArray(inputStream))); }