private void assertFileContains(List<String> expected,String filename) throws Exception {
  try (BufferedReader reader=new BufferedReader(new FileReader(filename))){
    List<String> actual=new ArrayList<>();
    for (; ; ) {
      String line=reader.readLine();
      if (line == null) {
        break;
      }
      actual.add(line);
    }
    assertEquals(expected,actual);
  }
 }

private void assertFileContains ( List < String > expected , String filename ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new FileReader ( filename ) ) ) { List < String > actual = new ArrayList < > ( ) ; for ( ; ; ) { String line = reader . readLine ( ) ; if ( line == null ) { break ; } actual . add ( line ) ; } assertEquals ( expected , actual ) ; } }
assert that a file contains the lines provided , in the same order as expected .
