@Test
    public void testCachingTwoStrings() throws Exception {
        for (int i = 0; i < 20; i++) {
            cachedTranslator.translate("This is a test string to translate!", "en", "no");
            cachedTranslator.translate("This is a different string...", "en", "fr");
        }
        assertEquals(cachedTranslator.getNumTranslationPairs(), 2,
                "Cache doesn't have two translation pairs!");
        assertEquals(cachedTranslator.getNumTranslationsFor("en", "no"), 1,
                "Cache has more than en to no translation!");
        assertEquals(cachedTranslator.getNumTranslationsFor("en", "fr"), 1,
                "Cache has more than en to fr translation!");
    }
Test harness for the {@link CachedTranslator}. Take care to choose your target language carefully
if you're testing the size of the cache!
tika-translate/src/test/java/org/apache/tika/language/translate/impl/CachedTranslatorTest.java