### Question:
Tesseract1 extends TessAPI1 implements ITesseract { @Override public List<Word> getWords(BufferedImage bi, int pageIteratorLevel) { this.init(); this.setTessVariables(); List<Word> words = new ArrayList<Word>(); try { setImage(bi, null); TessBaseAPIRecognize(handle, null); TessResultIterator ri = TessBaseAPIGetIterator(handle); TessPageIterator pi = TessResultIteratorGetPageIterator(ri); TessPageIteratorBegin(pi); do { Pointer ptr = TessResultIteratorGetUTF8Text(ri, pageIteratorLevel); String text = ptr.getString(0); TessAPI1.TessDeleteText(ptr); float confidence = TessResultIteratorConfidence(ri, pageIteratorLevel); IntBuffer leftB = IntBuffer.allocate(1); IntBuffer topB = IntBuffer.allocate(1); IntBuffer rightB = IntBuffer.allocate(1); IntBuffer bottomB = IntBuffer.allocate(1); TessPageIteratorBoundingBox(pi, pageIteratorLevel, leftB, topB, rightB, bottomB); int left = leftB.get(); int top = topB.get(); int right = rightB.get(); int bottom = bottomB.get(); Word word = new Word(text, confidence, new Rectangle(left, top, right - left, bottom - top)); words.add(word); } while (TessPageIteratorNext(pi, pageIteratorLevel) == TRUE); return words; } catch (Exception e) { return words; } finally { dispose(); } }  @Override void setDatapath(String datapath); @Override void setLanguage(String language); @Override void setOcrEngineMode(int ocrEngineMode); @Override void setPageSegMode(int mode); void setHocr(boolean hocr); @Override void setTessVariable(String key, String value); @Override void setConfigs(List<String> configs); @Override String doOCR(File imageFile); @Override String doOCR(File imageFile, Rectangle rect); @Override String doOCR(BufferedImage bi); @Override String doOCR(BufferedImage bi, Rectangle rect); @Override String doOCR(List<IIOImage> imageList, Rectangle rect); @Override String doOCR(List<IIOImage> imageList, String filename, Rectangle rect); @Override String doOCR(int xsize, int ysize, ByteBuffer buf, Rectangle rect, int bpp); @Override String doOCR(int xsize, int ysize, ByteBuffer buf, String filename, Rectangle rect, int bpp); @Override void createDocuments(String filename, String outputbase, List<RenderedFormat> formats); @Override void createDocuments(String[] filenames, String[] outputbases, List<RenderedFormat> formats); @Override List<Rectangle> getSegmentedRegions(BufferedImage bi, int pageIteratorLevel); @Override List<Word> getWords(BufferedImage bi, int pageIteratorLevel);  }### Answer:
@Test public void testGetWords() throws Exception { logger.info("getWords"); File imageFile = new File(this.testResourcesDataPath, "101.jpg"); String expResult = "The (quick) [brown] {fox} jumps!\nOver the $43,456.78 <lazy> #90 dog"; String[] expResults = expResult.split("\\s"); int pageIteratorLevel = TessPageIteratorLevel.RIL_WORD; logger.info("PageIteratorLevel: " + Utils.getConstantName(pageIteratorLevel, TessPageIteratorLevel.class)); BufferedImage bi = ImageIO.read(imageFile); List<Word> result = instance.getWords(bi, pageIteratorLevel); for (Word word : result) { logger.info(word.toString()); } List<String> text = new ArrayList<String>(); for (Word word : result.subList(0, expResults.length)) { text.add(word.getText()); } assertArrayEquals(expResults, text.toArray()); }