@Test
public void testBlockWrite() throws Exception {

	StringWriter stringWriter = new StringWriter();
	UnsyncBufferedWriter unsyncBufferedWriter = new UnsyncBufferedWriter(
		stringWriter, 3);
	// Normal
	unsyncBufferedWriter.write("ab".toCharArray());
	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());
	unsyncBufferedWriter.write("c".toCharArray());
	buffer = (char[])_bufferField.get(unsyncBufferedWriter);
	Assert.assertEquals(3, _countField.getInt(unsyncBufferedWriter));
	Assert.assertEquals('a', buffer[0]);
	Assert.assertEquals('b', buffer[1]);
	Assert.assertEquals('c', buffer[2]);
	stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(0, stringBuffer.length());
	// Auto flush
	unsyncBufferedWriter.write("de".toCharArray());
	buffer = (char[])_bufferField.get(unsyncBufferedWriter);
	Assert.assertEquals(2, _countField.getInt(unsyncBufferedWriter));
	Assert.assertEquals('d', buffer[0]);
	Assert.assertEquals('e', buffer[1]);
	stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(3, stringBuffer.length());
	Assert.assertEquals("abc", stringBuffer.toString());
	// Direct with auto flush
	unsyncBufferedWriter.write("fgh".toCharArray());
	_bufferField.get(unsyncBufferedWriter);
	Assert.assertEquals(0, _countField.getInt(unsyncBufferedWriter));
	stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(8, stringBuffer.length());
	Assert.assertEquals("abcdefgh", stringBuffer.toString());
	// Direct without auto flush
	unsyncBufferedWriter.write("ijk".toCharArray());
	Assert.assertEquals(0, _countField.getInt(unsyncBufferedWriter));
	stringBuffer = stringWriter.getBuffer();
	Assert.assertEquals(11, stringBuffer.length());
	Assert.assertEquals("abcdefghijk", stringBuffer.toString());
}