@Test
    public void testLanguageDetection() throws IOException {
        for (String language : languages) {
            ProfilingWriter writer = new ProfilingWriter();
            writeTo(language, writer);
            LanguageIdentifier identifier = null;
            identifier = new LanguageIdentifier(writer.getProfile());
            assertEquals(language, identifier.getLanguage());
            // Lithuanian is detected but isn't reasonably certain:
            if (!language.equals("lt")) {
                assertTrue(identifier.isReasonablyCertain(), identifier.toString());
            }
        }
    }
JUnit based test of class {@link LanguageIdentifier}.

@author Sami Siren
@author Jerome Charron - http://frutch.free.fr/
tika-langdetect/tika-langdetect-tika/src/test/java/org/apache/tika/langdetect/tika/LanguageIdentifierTest.java