### Question:
UTF7CharsetProviderSPI extends CharsetProvider { @Override @Nullable public Charset charsetForName (@Nonnull final String sCharsetName) { final String sRealCharsetName = sCharsetName.toUpperCase (Locale.US); for (final Charset aCharset : m_aCharsets) if (aCharset.name ().equals (sRealCharsetName)) return aCharset; for (final Charset aCharset : m_aCharsets) if (aCharset.aliases ().contains (sRealCharsetName)) return aCharset; return null; } UTF7CharsetProviderSPI(); @Override @Nullable Charset charsetForName(@Nonnull final String sCharsetName); @Override Iterator <Charset> charsets();  }### Answer:
@Test public void testModifiedUTF7 () { final Charset charset = tested.charsetForName ("x-modified-UTF-7"); assertNotNull ("charset not found", charset); assertEquals (UTF7CharsetModified.class, charset.getClass ()); assertEquals (charset, tested.charsetForName ("x-imap-modified-utf-7")); assertEquals (charset, tested.charsetForName ("x-imap4-modified-utf7")); assertEquals (charset, tested.charsetForName ("x-imap4-modified-utf-7")); assertEquals (charset, tested.charsetForName ("x-RFC3501")); assertEquals (charset, tested.charsetForName ("x-RFC-3501")); }
@Test public void testUTF7 () { final Charset charset = tested.charsetForName ("UTF-7"); assertNotNull ("charset not found", charset); assertEquals (UTF7Charset.class, charset.getClass ()); assertEquals (charset, tested.charsetForName ("utf-7")); assertEquals (charset, tested.charsetForName ("UNICODE-1-1-UTF-7")); assertEquals (charset, tested.charsetForName ("csUnicode11UTF7")); assertEquals (charset, tested.charsetForName ("x-RFC2152")); assertEquals (charset, tested.charsetForName ("x-RFC-2152")); }
@Test public void testUTF7optional () { final Charset charset = tested.charsetForName ("X-UTF-7-OPTIONAL"); assertNotNull ("charset not found", charset); assertEquals (UTF7Charset.class, charset.getClass ()); assertEquals (charset, tested.charsetForName ("x-utf-7-optional")); assertEquals (charset, tested.charsetForName ("x-RFC2152-optional")); assertEquals (charset, tested.charsetForName ("x-RFC-2152-optional")); }
@Test public void testNotHere () { assertNull (tested.charsetForName ("X-DOES-NOT-EXIST")); }
@Test public void testTurkish () { Locale.setDefault (new Locale ("tr", "TR")); assertEquals (tested.charsetForName ("UTF-7"), tested.charsetForName ("unicode-1-1-utf-7")); }