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