FixedFileQueryDAO extends AbstractFileQueryDAO { @Override public <T> FileLineIterator<T> execute(String fileName, Class<T> clazz) { FixedFileLineIterator<T> fileLineIterator = new FixedFileLineIterator<T>( fileName, clazz, getColumnParserMap()); return fileLineIterator; }  @Override FileLineIterator<T> execute(String fileName, Class<T> clazz);  }
@Test public void testExecute01() throws Exception { FixedFileQueryDAO fileQueryDAO = new FixedFileQueryDAO(); URL url = FixedFileLineIteratorTest.class.getResource("/aaa.txt"); String fileName = url.getPath(); Class<FixedFileQueryDAO_Stub01> clazz = FixedFileQueryDAO_Stub01.class; Map<String, ColumnParser> columnParser = new HashMap<String, ColumnParser>(); ColumnParser parser = new FixedFileQueryDAO_ColumnParserStub01(); columnParser.put("java.lang.String", parser); ReflectionTestUtils.setField(fileQueryDAO, "columnParserMap", columnParser); FileLineIterator<FixedFileQueryDAO_Stub01> fileLineiterator = fileQueryDAO .execute(fileName, clazz); assertEquals(FixedFileLineIterator.class, fileLineiterator.getClass()); assertEquals(fileName, ReflectionTestUtils.getField(fileLineiterator, "fileName")); assertEquals(clazz, ReflectionTestUtils.getField(fileLineiterator, "clazz")); assertSame(columnParser, ReflectionTestUtils.getField(fileLineiterator, "columnParserMap")); }