@Test
    public void testCachingSingleString() throws Exception {
        for (int i = 0; i < 20; i++) {
            cachedTranslator.translate("This is a test string to translate!", "en", "sv");
        }
        assertEquals(cachedTranslator.getNumTranslationPairs(), 1,
                "Cache doesn't have a single translation pair!");
        assertEquals(cachedTranslator.getNumTranslationsFor("en", "sv"), 1,
                "Cache has more than one element!");
    }
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