FixedFileUpdateDAO extends AbstractFileUpdateDAO { @Override public <T> FileLineWriter<T> execute(String fileName, Class<T> clazz) { FixedFileLineWriter<T> fileLineWriter = new FixedFileLineWriter<T>( fileName, clazz, getColumnFormatterMap()); return fileLineWriter; }  @Override FileLineWriter<T> execute(String fileName, Class<T> clazz);  }
@Test public void testExecute01() throws Exception { FixedFileUpdateDAO fileUpdateDAO = new FixedFileUpdateDAO(); String fileName = "aaa"; Class<FixedFileUpdateDAO_Stub01> clazz = FixedFileUpdateDAO_Stub01.class; Map<String, ColumnFormatter> columnFormatterMap = new HashMap<String, ColumnFormatter>(); columnFormatterMap.put("java.lang.String", new NullColumnFormatter()); ReflectionTestUtils.setField(fileUpdateDAO, "columnFormatterMap", columnFormatterMap); FileLineWriter<FixedFileUpdateDAO_Stub01> fileLineWriter = fileUpdateDAO .execute(fileName, clazz); assertEquals(FixedFileLineWriter.class.getName(), fileLineWriter .getClass().getName()); assertSame(fileName, ReflectionTestUtils.getField(fileLineWriter, "fileName")); assertSame(clazz, ReflectionTestUtils.getField(fileLineWriter, "clazz")); assertSame(columnFormatterMap, ReflectionTestUtils.getField( fileLineWriter, "columnFormatterMap")); fileLineWriter.closeFile(); File file = new File("aaa"); file.delete(); }