### Question:
CharsetHelper { @Nonnull public static Charset getCharsetFromName (@Nonnull @Nonempty final String sCharsetName) { ValueEnforcer.notNull (sCharsetName, "CharsetName"); try { return Charset.forName (sCharsetName); } catch (final IllegalCharsetNameException ex) { throw new IllegalArgumentException ("Charset '" + sCharsetName + "' unsupported in Java", ex); } catch (final UnsupportedCharsetException ex) { throw new IllegalArgumentException ("Charset '" + sCharsetName + "' unsupported on this platform", ex); } } private  CharsetHelper(); @Nonnull static Charset getCharsetFromName(@Nonnull @Nonempty final String sCharsetName); @Nullable static Charset getCharsetFromNameOrNull(@Nullable final String sCharsetName); @Nullable static Charset getCharsetFromNameOrDefault(@Nullable final String sCharsetName, @Nullable final Charset aDefault); @Nonnull @ReturnsMutableCopy static ICommonsOrderedMap <String, Charset> getAllCharsets(); @Nullable static String getAsStringInOtherCharset(@Nullable final String sText,
                                                  @Nonnull final Charset aCurrentCharset,
                                                  @Nonnull final Charset aNewCharset); @Nonnegative static int getUTF8ByteCount(@Nullable final String s); @Nonnegative static int getUTF8ByteCount(@Nullable final char [] aChars); @Nonnegative static int getUTF8ByteCount(final char c); @Nonnegative static int getUTF8ByteCount(@Nonnegative final int c); @Nonnull static InputStreamAndCharset getInputStreamAndCharsetFromBOM(@Nonnull @WillNotClose final InputStream aIS); @Nonnull static InputStreamReader getReaderByBOM(@Nonnull final InputStream aIS, @Nonnull final Charset aFallbackCharset);  }### Answer:
@Test @SuppressFBWarnings (value = "NP_NONNULL_PARAM_VIOLATION") public void testCharsetFromName () { assertNotNull (CharsetHelper.getCharsetFromName ("UTF-8")); try { CharsetHelper.getCharsetFromName (null); fail (); } catch (final NullPointerException ex) {} try { CharsetHelper.getCharsetFromName ("does not exist"); fail (); } catch (final IllegalArgumentException ex) {} try { CharsetHelper.getCharsetFromName ("bla"); fail (); } catch (final IllegalArgumentException ex) {} }