@Test public void getMarkupLanguagesNull() { MarkupLanguageProvider provider = new MarkupLanguageProvider() { @Override protected Set<MarkupLanguage> loadMarkupLanguages() { return null; } }; NullPointerException npe = assertThrows(NullPointerException.class, () -> provider.getMarkupLanguages()); assertTrue(npe.getMessage().contains("loadMarkupLanguages() must not return null")); }
public final Set<MarkupLanguage> getMarkupLanguages() { Set<MarkupLanguage> languages = ImmutableSet .copyOf(Objects.requireNonNull(loadMarkupLanguages(), "loadMarkupLanguages() must not return null")); assertLanguageNames(languages); return languages; }
MarkupLanguageProvider { public final Set<MarkupLanguage> getMarkupLanguages() { Set<MarkupLanguage> languages = ImmutableSet .copyOf(Objects.requireNonNull(loadMarkupLanguages(), "loadMarkupLanguages() must not return null")); assertLanguageNames(languages); return languages; } }
MarkupLanguageProvider { public final Set<MarkupLanguage> getMarkupLanguages() { Set<MarkupLanguage> languages = ImmutableSet .copyOf(Objects.requireNonNull(loadMarkupLanguages(), "loadMarkupLanguages() must not return null")); assertLanguageNames(languages); return languages; }  }
MarkupLanguageProvider { public final Set<MarkupLanguage> getMarkupLanguages() { Set<MarkupLanguage> languages = ImmutableSet .copyOf(Objects.requireNonNull(loadMarkupLanguages(), "loadMarkupLanguages() must not return null")); assertLanguageNames(languages); return languages; }  final Set<MarkupLanguage> getMarkupLanguages(); }
MarkupLanguageProvider { public final Set<MarkupLanguage> getMarkupLanguages() { Set<MarkupLanguage> languages = ImmutableSet .copyOf(Objects.requireNonNull(loadMarkupLanguages(), "loadMarkupLanguages() must not return null")); assertLanguageNames(languages); return languages; }  final Set<MarkupLanguage> getMarkupLanguages();  }