@Test
public void testDecode() throws Exception {

	Assert.assertEquals(
		CharBuffer.wrap("abc"),
		CharsetDecoderUtil.decode(
			"US-ASCII", CodingErrorAction.REPORT,
			ByteBuffer.wrap("abc".getBytes("US-ASCII"))));
	try {
		CharsetDecoderUtil.decode(
			"US-ASCII", CodingErrorAction.REPORT,
			ByteBuffer.wrap(new byte[] {-1, -2, -3, -4}));
		Assert.fail();
	}
	catch (MalformedInputException malformedInputException) {
		Assert.assertEquals(1, malformedInputException.getInputLength());
	}
	TestCharset testCharset = new TestCharset();
	Object cache1 = ReflectionTestUtil.getAndSetFieldValue(
		Charset.class, "cache1",
		new Object[] {testCharset.name(), testCharset});
	try {
		CharsetDecoderUtil.decode(
			testCharset.name(), ByteBuffer.wrap(new byte[0]));
		Assert.fail();
	}
	catch (Error e) {
		Assert.assertSame(
			testCharset.getCharacterCodingException(), e.getCause());
	}
	finally {
		ReflectionTestUtil.setFieldValue(Charset.class, "cache1", cache1);
	}
}