EnsemblEnhancerParser { public void parse() { Path inFile = dataPath; Path outFile = outputPath; logger.info("Parsing Ensembl enhancers file: {} Writing out to: {}", inFile, outFile); try (BufferedWriter writer = Files.newBufferedWriter(outFile, Charset.defaultCharset()); Stream<String> lines = Files.lines(inFile)) { lines .filter(unplacedFragments()) .map(tabsToPipe()) .map(xTo23()) .map(yTo24()) .forEach(writeLineToOutFile(writer)); } catch (IOException ex) { logger.error(null, ex); } logger.info("Done"); } EnsemblEnhancerParser(Path dataPath, Path outputPath); void parse();  }
@Test @ExtendWith(TempDirectory.class) public void parse(@TempDir Path tempDir) throws Exception { Path inputFile = Paths.get("src/test/resources/genome/ensembl_enhancers.tsv"); Path outputFile = tempDir.resolve("test_ensembl_enhancers.pg"); Path expectedOutputFile = Paths.get("src/test/resources/genome/ensembl_enhancers.pg"); EnsemblEnhancerParser instance = new EnsemblEnhancerParser(inputFile, outputFile); instance.parse(); List<String> expected = Files.readAllLines(expectedOutputFile); List<String> actual = Files.readAllLines(outputFile); assertThat(actual, equalTo(expected)); }