PlainFileQueryDAO extends AbstractFileQueryDAO { @SuppressWarnings("unchecked") @Override public <T> FileLineIterator<T> execute(String fileName, Class<T> clazz) { PlainFileLineIterator fileLineIterator = new PlainFileLineIterator( fileName, clazz, getColumnParserMap()); return (FileLineIterator<T>) fileLineIterator; }  @SuppressWarnings("unchecked") @Override FileLineIterator<T> execute(String fileName, Class<T> clazz);  }
@Test public void testExcecute01() throws Exception { PlainFileQueryDAO plainFileQueryDAO = new PlainFileQueryDAO(); URL url = this.getClass().getResource("File_Empty.txt"); String fileName = url.getPath(); Class<PlainFileQueryDAO_Stub01> clazz = PlainFileQueryDAO_Stub01.class; Map<String, ColumnParser> columnParserMap = new HashMap<String, ColumnParser>(); columnParserMap.put("java.lang.String", new NullColumnParser()); ReflectionTestUtils.setField(plainFileQueryDAO, "columnParserMap", columnParserMap); FileLineIterator<PlainFileQueryDAO_Stub01> result = plainFileQueryDAO .execute(fileName, clazz); assertEquals(PlainFileLineIterator.class, result.getClass()); assertSame(fileName, ReflectionTestUtils.getField(result, "fileName")); assertSame(clazz, ReflectionTestUtils.getField(result, "clazz")); assertSame(columnParserMap, ReflectionTestUtils.getField(result, "columnParserMap")); }