public void testEmptyLoopBreakCondition() throws IOException, SAXException, InvalidFormatException { InputStream inputXML = new BufferedInputStream(getClass().getResourceAsStream(xmlConfig)); XLSReader reader = ReaderBuilder.buildFromXML(inputXML); assertNotNull(reader); InputStream inputXLS = new BufferedInputStream(getClass().getResourceAsStream(employeeDataXLS)); List employees = new ArrayList(); Map beans = new HashMap(); beans.put("employees", employees); reader.read(inputXLS, beans); assertNotNull(employees); assertEquals(4, employees.size()); checkEmployee((Employee) employees.get(0), "Oleg", new Integer(34), new Double(3000.0), null); checkEmployee((Employee) employees.get(1), "Yuriy", new Integer(29), new Double(2500.0), null); checkEmployee((Employee) employees.get(2), "Alex", new Integer(30), new Double(2300.0), null); checkEmployee((Employee) employees.get(3), "Vlad", new Integer(31), new Double(2000.0), null); inputXLS.close(); }
public void testReadIdentifiers() throws IOException, SAXException, InvalidFormatException { InputStream inputXML = new BufferedInputStream(getClass().getResourceAsStream(idsXML)); XLSReader reader = ReaderBuilder.buildFromXML(inputXML); assertNotNull(reader); InputStream inputXLS = new BufferedInputStream(getClass().getResourceAsStream(idsXLS)); List employees = new ArrayList(); Map beans = new HashMap(); beans.put("employees", employees); reader.read(inputXLS, beans); assertNotNull(employees); assertEquals(6, employees.size()); checkEmployeeId((Employee) employees.get(0), "Oleg", "a123b"); checkEmployeeId((Employee) employees.get(1), "Yuriy", "a567"); checkEmployeeId((Employee) employees.get(2), "Alex", "89x"); checkEmployeeId((Employee) employees.get(3), "Vlad", "xyz"); checkEmployeeId((Employee) employees.get(4), "Sergey", "123"); checkEmployeeId((Employee) employees.get(5), "Slava", "5"); inputXLS.close(); }