@Test
    public void testCacheContains() throws Exception {
        String text = "Text that should be long enough to detect a language from.";
        assertFalse(cachedTranslator.contains(text, "en", "it"),
                "Cache should not contain a translation!");
        cachedTranslator.translate(text, "en", "it");
        assertTrue(cachedTranslator.contains(text, "en", "it"),
                "Cache should contain a translation!");
        assertTrue(cachedTranslator.contains(text, "it"),
                "Cache should detect source language when checking if contains.");
    }
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