@Test public void getMarkupLanguagesDuplicatedNames() { MarkupLanguageProvider provider = new MarkupLanguageProvider() { @Override protected Set<MarkupLanguage> loadMarkupLanguages() { return ImmutableSet.<MarkupLanguage> of(new MockMarkupLanguage("Test"), new MockMarkupLanguage("Test")); } }; IllegalStateException ise = assertThrows(IllegalStateException.class, () -> provider.getMarkupLanguages()); assertTrue(ise.getMessage().contains("Language name 'Test' must not be provided more than once")); }
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();  }