@Test
 public void testImageMagick() throws Exception {
   InputStream stream =
       TesseractOCRConfig.class.getResourceAsStream("/test-properties/TesseractOCR.properties");
   TesseractOCRConfig config = new TesseractOCRConfig(stream);
   String[] CheckCmd = {config.getImageMagickPath() + TesseractOCRParser.getImageMagickProg()};
   assumeTrue(ExternalParser.check(CheckCmd));
 }
  /*
  Check that if Tesseract is not found, the TesseractOCRParser claims to not support
  any file types. So, the standard image parser is called instead.
   */
  @Test
  public void offersNoTypesIfNotFound() throws Exception {
    TesseractOCRParser parser = new TesseractOCRParser();
    DefaultParser defaultParser = new DefaultParser();
    MediaType png = MediaType.image("png");

    // With an invalid path, will offer no types
    TesseractOCRConfig invalidConfig = new TesseractOCRConfig();
    invalidConfig.setTesseractPath("/made/up/path");

    ParseContext parseContext = new ParseContext();
    parseContext.set(TesseractOCRConfig.class, invalidConfig);

    // No types offered
    assertEquals(0, parser.getSupportedTypes(parseContext).size());

    // And DefaultParser won't use us
    assertEquals(ImageParser.class, defaultParser.getParsers(parseContext).get(png).getClass());
  }
 private boolean canRun(TesseractOCRConfig config) {
   String[] checkCmd = {config.getTesseractPath() + getTesseractProg()};
   // If Tesseract is not on the path, do not run the test.
   return ExternalParser.check(checkCmd);
 }