CaptchaUtil { @Contract(pure = true) public int evalCalcCaptcha(BufferedImage image) { String str = ocrUtil.ocrCalcCaptcha(image); if (str == null) return -1; return calc(str); } CaptchaUtil();  CaptchaUtil(OCRUtil ocrUtil); @Contract(pure = true) int evalCalcCaptcha(BufferedImage image);  }
@Test public void evalCalcCaptcha() throws Exception { CaptchaUtil util = new CaptchaUtil(); List<String> excepted = Files.readAllLines(Paths.get( getClass().getResource("/captcha/excepted_values.txt").toURI())); for (int i = 0; i < 50;i++) { int value = util.evalCalcCaptcha(ImageIO.read( getClass().getResource("/captcha/captcha" + i + ".png"))); System.out.println(value); assertEquals(Integer.parseInt(excepted.get(i).trim()), value); } }