@Test
    public void testUniversalDeclarationOfHumanRights() throws Exception {
        LanguageDetector detector = new OptimaizeLangDetector();
        detector.loadModels();

        LanguageWriter writer = new LanguageWriter(detector);

        Map<String, String> knownText = getTestLanguages("udhr-known.txt");
        for (String language : knownText.keySet()) {
            writer.reset();
            writer.append(knownText.get(language));

            LanguageResult result = detector.detect();
            assertNotNull(result);

            assertEquals(language, result.getLanguage());
            // System.out.println(String.format("'%s': %s (%f)", language,
            // result.getConfidence(), result.getRawScore()));
        }

        Map<String, String> unknownText = getTestLanguages("udhr-unknown.txt");
        for (String language : unknownText.keySet()) {
            writer.reset();
            writer.append(unknownText.get(language));

            LanguageResult result = detector.detect();
            if (result != null) {
                assertFalse(result.isReasonablyCertain());
                // System.out.println(String.format("Looking for '%s', got '%s': %s (%f)",
                // language, result.getLanguage(), result.getConfidence(), result.getRawScore()));
            }
        }

        writer.close();
    }
Test correct detection for the many (short) translations of the
"Universal Declaration of Human Rights (Article 1)", at
http://www.omniglot.com/udhr
<p>
Also make sure we get uncertain results for some set of unsupported
languages.

@throws Exception
tika-langdetect/tika-langdetect-optimaize/src/test/java/org/apache/tika/langdetect/optimaize/OptimaizeLangDetectorTest.java