@Test
public void testWriteError() throws IOException {

	OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
		new DummyOutputStream(), "US-ASCII");
	CharsetEncoder charsetEncoder = ReflectionTestUtil.getFieldValue(
		outputStreamWriter, "_charsetEncoder");
	charsetEncoder.onUnmappableCharacter(CodingErrorAction.REPORT);
	try {
		outputStreamWriter.write("测试");
		Assert.fail();
	}
	catch (UnmappableCharacterException unmappableCharacterException) {
		Assert.assertEquals(
			1, unmappableCharacterException.getInputLength());
	}
}