@Test public void canExtractTwoSymbolsFromLine() throws Exception { String xSymbol = ""; xSymbol += "xxx\n"; xSymbol += "xxx\n"; xSymbol += "xxx\n"; String ySymbol = ""; ySymbol += "yyy\n"; ySymbol += "yyy\n"; ySymbol += "yyy\n"; String symbols = ""; symbols += "xxxyyy\n"; symbols += "xxxyyy\n"; symbols += "xxxyyy\n"; when(symbolReader.nextLine()).thenReturn(symbols); List<String> expectedSymbols = new ArrayList<>(); expectedSymbols.add(xSymbol); expectedSymbols.add(ySymbol); assertEquals(expectedSymbols, symbolExtractor.extractNextLine()); }
public static void main(String[] args) throws Exception { File symbolsFile = new File("entries.txt"); SymbolFileReader reader = new SymbolFileReader(symbolsFile); SymbolExtractor extractor = new SymbolExtractor(reader); EntryOcr ocr = new EntryOcr(); for (int i = 0; i < 3; i++) { List<String> symbols = extractor.extractNextLine(); System.out.println(ocr.recognize(symbols)); } }
@Test public void canExtractOneSymbolFromLine() throws Exception { String symbol = ""; symbol += "xxx\n"; symbol += "xxx\n"; symbol += "xxx\n"; when(symbolReader.nextLine()).thenReturn(symbol); List<String> expectedSymbols = asList(symbol); assertEquals(expectedSymbols, symbolExtractor.extractNextLine()); }