CSVFileQueryDAO extends AbstractFileQueryDAO { @Override public <T> FileLineIterator<T> execute(String fileName, Class<T> clazz) { CSVFileLineIterator<T> fileLineIterator = new CSVFileLineIterator<T>( fileName, clazz, getColumnParserMap()); return fileLineIterator; }  @Override FileLineIterator<T> execute(String fileName, Class<T> clazz);  }
@Test public void testExecute01() throws Exception { CSVFileQueryDAO fileQueryDAO = new CSVFileQueryDAO(); URL url = this.getClass().getResource("File_Empty.txt"); String fileName = url.getPath(); Class<CSVFileQueryDAO_Stub01> clazz = CSVFileQueryDAO_Stub01.class; Map<String, ColumnParser> columnParser = new HashMap<String, ColumnParser>(); ColumnParser parser = new CSVFileQueryDAO_ColumnParserStub01(); columnParser.put("java.lang.String", parser); ReflectionTestUtils.setField(fileQueryDAO, "columnParserMap", columnParser); FileLineIterator<CSVFileQueryDAO_Stub01> fileLineIterator = fileQueryDAO .execute(fileName, clazz); assertEquals(CSVFileLineIterator.class, fileLineIterator.getClass()); assertEquals(fileName, ReflectionTestUtils.getField(fileLineIterator, "fileName")); assertSame(clazz, ReflectionTestUtils.getField(fileLineIterator, "clazz")); assertSame(columnParser, ReflectionTestUtils.getField(fileLineIterator, "columnParserMap")); }