PlainFileUpdateDAO extends AbstractFileUpdateDAO { @SuppressWarnings("unchecked") @Override public <T> FileLineWriter<T> execute(String fileName, Class<T> clazz) { PlainFileLineWriter fileLineWriter = new PlainFileLineWriter(fileName, clazz, getColumnFormatterMap()); return (FileLineWriter<T>) fileLineWriter; }  @SuppressWarnings("unchecked") @Override FileLineWriter<T> execute(String fileName, Class<T> clazz);  }
@Test public void testExecute01() throws Exception { PlainFileUpdateDAO fileUpdateDAO = new PlainFileUpdateDAO(); URL url = this.getClass().getResource("File_Empty.txt"); String fileName = url.getPath(); Class<PlainFileUpdateDAO_Stub01> clazz = PlainFileUpdateDAO_Stub01.class; Map<String, ColumnFormatter> columnFormatterMap = new HashMap<String, ColumnFormatter>(); columnFormatterMap.put("java.lang.String", new NullColumnFormatter()); ReflectionTestUtils.setField(fileUpdateDAO, "columnFormatterMap", columnFormatterMap); FileLineWriter<PlainFileUpdateDAO_Stub01> fileLineWriter = fileUpdateDAO .execute(fileName, clazz); assertEquals(PlainFileLineWriter.class, fileLineWriter.getClass()); assertSame(fileName, ReflectionTestUtils.getField(fileLineWriter, "fileName")); assertSame(clazz, ReflectionTestUtils.getField(fileLineWriter, "clazz")); assertSame(columnFormatterMap, ReflectionTestUtils.getField( fileLineWriter, "columnFormatterMap")); }