@Test
public void testValidateInvalidLanguage() {

    List<String> invalidLanguages = Arrays.asList(
            "", "+", "en", "en+", "eng+fra+", "rm -rf *");
    TesseractOCRConfig config = new TesseractOCRConfig();
    for (String language : invalidLanguages) {
        try {
            config.setLanguage(language);
            fail("Invalid language set: " + language);
        } catch (IllegalArgumentException e) {
            // expected exception thrown
        }
    }
}