ActiveGrammarSet implements ScopedSetObserver<GrammarDocument> { public Collection<GrammarType> getGrammarTypes() { final Collection<GrammarType> types = new java.util.HashSet<GrammarType>(); for (GrammarDocument document : grammars) { final GrammarType type = document.getMediaType(); if (type != null) { types.add(type); } } return types; } ActiveGrammarSet(final ScopeObserver scopeObserver); void addActiveGrammarSetObserver(
            final ActiveGrammarSetObserver obs); void removeActiveGrammarSetObserver(
            final ActiveGrammarSetObserver obs); int size(); void add(final GrammarDocument grammar); void addAll(final Collection<GrammarDocument> grams); void removeAll(final Collection<GrammarDocument> grams); boolean contains(final GrammarDocument document); Collection<GrammarDocument> getGrammars(); Collection<GrammarType> getGrammarTypes(); Collection<ModeType> getModeTypes(); @Override void scopedSetChange(final ScopedSet<GrammarDocument> set,
            final Collection<GrammarDocument> removed);  }
@Test public void testGetGrammarTypes() throws Exception { final ActiveGrammarSet set = new ActiveGrammarSet(observer); set.add(document1); set.add(document2); final Collection<GrammarType> types = set.getGrammarTypes(); Assert.assertEquals(1, types.size()); }