private <T>void runTestWrite(XmlWriter<T> writer,List<T> bundle,List<String> expected) throws Exception {
  File tmpFile=tmpFolder.newFile("foo.txt");
  try (FileOutputStream fileOutputStream=new FileOutputStream(tmpFile)){
    writeBundle(writer,bundle,fileOutputStream.getChannel());
  }
   List<String> lines=new ArrayList<>();
  try (BufferedReader reader=new BufferedReader(new FileReader(tmpFile))){
    for (; ; ) {
      String line=reader.readLine();
      if (line == null) {
        break;
      }
      line=line.trim();
      if (line.length() > 0) {
        lines.add(line);
      }
    }
    assertEquals(expected,lines);
  }
 }

private < T > void runTestWrite ( XmlWriter < T > writer , List < T > bundle , List < String > expected ) throws Exception { File tmpFile = tmpFolder . newFile ( "foo.txt" ) ; try ( FileOutputStream fileOutputStream = new FileOutputStream ( tmpFile ) ) { writeBundle ( writer , bundle , fileOutputStream . getChannel ( ) ) ; } List < String > lines = new ArrayList < > ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( tmpFile ) ) ) { for ( ; ; ) { String line = reader . readLine ( ) ; if ( line == null ) { break ; } line = line . trim ( ) ; if ( line . length ( ) > 0 ) { lines . add ( line ) ; } } assertEquals ( expected , lines ) ; } }
write a bundle with an xmlwriter and verify the output is expected .
