@Test public void testUnknownCharset() throws Exception { // We only want to run this test if we can guarantee that the charset _doesn't_ exist in the // system first. Otherwise, we'll just have to ignore this test. assumeThat(Charset.isSupported(UNKNOWN_CHARSET_NAME), is(false)); // We're good to run the test. thrown.expect(ParameterException.class); thrown.expectMessage("unknown encoding"); cc.convert(UNKNOWN_CHARSET_NAME); }
@Test public void testIllegalCharsetName() throws Exception { thrown.expect(ParameterException.class); thrown.expectMessage("unknown encoding"); cc.convert("!@#$%^&*("); }
@Test public void testConvert() throws Exception { assertThat(cc.convert("UTF-8"), is(Charset.forName("UTF-8"))); }