AbstractFileLineWriter implements FileLineWriter<T> { protected Writer getWriter() { return writer; } AbstractFileLineWriter(String fileName, Class<T> clazz,
            Map<String, ColumnFormatter> columnFormatterMap); @Override void printHeaderLine(List<String> headerLine); @Override void printDataLine(T t); @Override void printTrailerLine(List<String> trailerLine); @Override void closeFile(); String getFileName(); void setColumnFormatterMap(
            Map<String, ColumnFormatter> columnFormatterMap); abstract char getDelimiter(); abstract char getEncloseChar();  }
@Test public void testGetWriter01() throws Exception { String fileName = "fileName"; Class<AbstractFileLineWriter_Stub01> clazz = AbstractFileLineWriter_Stub01.class; Map<String, ColumnFormatter> columnFormatterMap = new HashMap<String, ColumnFormatter>(); columnFormatterMap.put("int", new IntColumnFormatter()); columnFormatterMap.put("java.lang.String", new NullColumnFormatter()); AbstractFileLineWriter<AbstractFileLineWriter_Stub01> fileLineWriter = new AbstractFileLineWriterImpl01<AbstractFileLineWriter_Stub01>(fileName, clazz, columnFormatterMap); Writer writer = null; try { writer = new BufferedWriter(new OutputStreamWriter((new FileOutputStream(fileName, true)), System .getProperty("file.encoding"))); ReflectionTestUtils.setField(fileLineWriter, "writer", writer); Writer result = fileLineWriter.getWriter(); assertNotNull(result); assertSame(writer, result); } finally { if (writer != null) { writer.close(); } File file = new File(fileName); file.delete(); } }