@Test
public void testToString() throws IOException {

	// Null input stream
	Assert.assertNull(StreamUtil.toString(null));
	// UTF8 encoding
	String s = "Hello World";
	byte[] uft8EncodedBytes = s.getBytes(StringPool.UTF8);
	Assert.assertEquals(
		s,
		StreamUtil.toString(
			new UnsyncByteArrayInputStream(uft8EncodedBytes)));
	// GB2313 encoding
	s = "测试";
	byte[] gb2312EncodedBytes = s.getBytes("GB2312");
	Assert.assertEquals(
		s,
		StreamUtil.toString(
			new UnsyncByteArrayInputStream(gb2312EncodedBytes), "GB2312"));
	Assert.assertNotEquals(
		s,
		StreamUtil.toString(
			new UnsyncByteArrayInputStream(gb2312EncodedBytes)));
}