@Test
public void testLatin1DecodeErrorHandlingReplace() throws IOException {

  ByteArrayOutputStream out = new ByteArrayOutputStream();
  generateLatin1InvalidSequence(out);
  Files.write(out.toByteArray(), file);
  ResettableInputStream in = initInputStream(DecodeErrorPolicy.REPLACE);
  int c;
  StringBuilder sb = new StringBuilder();
  while ((c = in.readChar()) != -1) {
    sb.append((char)c);
  }
  assertEquals("Invalid: (X)\n".replaceAll("X", "\ufffd"), sb.toString());
}