### Question:
AbstractCache implements VocabCache<T> { @Override public int numWords() { return vocabulary.size(); }  @Override void loadVocab(); @Override boolean vocabExists(); @Override void saveVocab(); @Override Collection<String> words(); @Override void incrementWordCount(String word); @Override void incrementWordCount(String word, int increment); @Override int wordFrequency(@NonNull String word); @Override boolean containsWord(String word); boolean containsElement(T element); @Override String wordAtIndex(int index); @Override T elementAtIndex(int index); @Override int indexOf(String label); @Override Collection<T> vocabWords(); @Override long totalWordOccurrences(); void setTotalWordOccurences(long value); @Override T wordFor(@NonNull String label); @Override T wordFor(long id); @Override void addWordToIndex(int index, String label); @Override void addWordToIndex(int index, long elementId); @Override @Deprecated void putVocabWord(String word); @Override int numWords(); @Override int docAppearedIn(String word); @Override void incrementDocCount(String word, long howMuch); @Override void setCountForDoc(String word, long count); @Override long totalNumberOfDocs(); @Override void incrementTotalDocCount(); @Override void incrementTotalDocCount(long by); void setTotalDocCount(long by); @Override Collection<T> tokens(); @Override boolean addToken(T element); void addToken(T element, boolean lockf); @Override T tokenFor(String label); @Override T tokenFor(long id); @Override boolean hasToken(String label); void importVocabulary(@NonNull VocabCache<T> vocabCache); @Override void updateWordsOccurrences(); @Override void removeElement(String label); @Override void removeElement(T element); String toJson(); static AbstractCache<T> fromJson(String jsonString);  }### Answer:
@Test public void testNumWords() throws Exception { AbstractCache<VocabWord> cache = new AbstractCache.Builder<VocabWord>().build(); cache.addToken(new VocabWord(1.0, "word")); cache.addToken(new VocabWord(1.0, "test")); assertEquals(2, cache.numWords()); }