/** * Test of TessBaseAPIPrintVariables method, of class TessAPI1. * * @throws Exception while persisting variables into a file. */ @Test public void testTessBaseAPIPrintVariablesToFile() throws Exception { logger.info("TessBaseAPIPrintVariablesToFile"); String var = "tessedit_char_whitelist"; String value = "0123456789"; TessAPI1.TessBaseAPISetVariable(handle, var, value); String filename = "printvar.txt"; TessAPI1.TessBaseAPIPrintVariablesToFile( handle, filename); // will crash if not invoked after some method File file = new File(filename); BufferedReader input = new BufferedReader(new FileReader(file)); StringBuilder strB = new StringBuilder(); String line; String EOL = System.getProperty("line.separator"); while ((line = input.readLine()) != null) { strB.append(line).append(EOL); } input.close(); file.delete(); assertTrue(strB.toString().contains(var + "\t" + value)); }