RealFileInput implements InputFile { public static InputFile forPath(final Path file) { return forPath(file, StandardCharsets.UTF_8); } private  RealFileInput(final Path path, final Charset charset); static InputFile forPath(final Path file); static InputFile forPath(final Path path, final Charset charset); @Override BufferedReader createReader(); @Override String getPath(); @Override String toString(); @Override boolean isRealFile(); @Override Path toPath();  }
@Test void testReadWithUtf8Encoding() throws IOException { final InputFile inputFile = RealFileInput .forPath(writeTempFile(CONTENT, StandardCharsets.UTF_8), StandardCharsets.UTF_8); assertThat(readContent(inputFile), equalTo(CONTENT)); }
@Test void testReadWithDefaultEncoding() throws IOException { final InputFile inputFile = RealFileInput .forPath(writeTempFile(CONTENT, StandardCharsets.UTF_8)); assertThat(readContent(inputFile), equalTo(CONTENT)); }
@Test void testReadWithIsoEncoding() throws IOException { final InputFile inputFile = RealFileInput.forPath( writeTempFile(CONTENT, StandardCharsets.ISO_8859_1), StandardCharsets.ISO_8859_1); assertThat(readContent(inputFile), equalTo(CONTENT)); }