Variant { public String getLanguageString() { return (language == null) ? null : language.toString(); } Variant(MediaType mediaType, String language, String encoding);  Variant(MediaType mediaType, String language, String country, String encoding);  Variant(MediaType mediaType, String language, String country, String languageVariant, String encoding);  Variant(MediaType mediaType, Locale language, String encoding); Locale getLanguage(); String getLanguageString(); MediaType getMediaType(); String getEncoding(); static VariantListBuilder mediaTypes(MediaType... mediaTypes); static VariantListBuilder languages(Locale... languages); static VariantListBuilder encodings(String... encodings); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void npeInGetLanguageString() { final Variant variant = new Variant(MediaType.TEXT_PLAIN_TYPE, (String) null, null); assertNull(variant.getLanguageString()); }