@Test
public void getCanonicalCharset() {

    assertEquals("ISO-8859-1", LocaleUtil.getCanonicalCharset("8859_1"));
    assertEquals("ISO-8859-1", LocaleUtil.getCanonicalCharset("ISO8859_1"));
    try {
        LocaleUtil.getCanonicalCharset("aaaabbbbcccc"); // UnsupportedCharsetException
        fail("Expected UnsupportedCharsetException");
    } catch (UnsupportedCharsetException e) {
    }
    try {
        LocaleUtil.getCanonicalCharset("aaaa<bbbb>cccc"); // IllegalCharsetNameException
        fail("Expected IllegalCharsetNameException");
    } catch (IllegalCharsetNameException e) {
    }
}