@Test
public void testStringWrite() throws Exception {

	StringWriter stringWriter = new StringWriter();
	UnsyncBufferedWriter unsyncBufferedWriter = new UnsyncBufferedWriter(
		stringWriter, 3);
	// Normal
	unsyncBufferedWriter.write("ab");
	char[] buffer = (char[])_bufferField.get(unsyncBufferedWriter);
	Assert.assertEquals(2, _countField.getInt(unsyncBufferedWriter));
	Assert.assertEquals('a', buffer[0]);
	Assert.assertEquals('b', buffer[1]);
	StringBuffer stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(0, stringBuffer.length());
	// Auto flush
	unsyncBufferedWriter.write("cd");
	buffer = (char[])_bufferField.get(unsyncBufferedWriter);
	Assert.assertEquals(1, _countField.getInt(unsyncBufferedWriter));
	Assert.assertEquals('d', buffer[0]);
	stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(3, stringBuffer.length());
	Assert.assertEquals("abc", stringBuffer.toString());
	// Cycle
	unsyncBufferedWriter.write("efghi".toCharArray());
	Assert.assertEquals(0, _countField.getInt(unsyncBufferedWriter));
	stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(9, stringBuffer.length());
	Assert.assertEquals("abcdefghi", stringBuffer.toString());
}