FantomEnhancerParser { public void parse() { Path inFile = dataPath; Path outFile = outputPath; logger.info("Parsing Fantom enhancers BED file: {} Writing out to: {}", inFile, outFile); try (BufferedReader reader = Files.newBufferedReader(inFile); BufferedWriter bedFileWriter = Files.newBufferedWriter(outFile, Charset.defaultCharset())) { String line; while ((line = reader.readLine()) != null) { String[] lineParts = line.split("\t"); String chr = parseChr(lineParts[0]); String start = lineParts[1]; String end = lineParts[2]; bedFileWriter.write(generateLine(chr, start, end)); bedFileWriter.newLine(); } } catch (IOException ex) { logger.error(null, ex); } logger.info("Done"); } FantomEnhancerParser(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/fantom_enhancers.bed"); Path outputFile = tempDir.resolve("test_fantom_enhancers.pg"); Path expectedOutputFile = Paths.get("src/test/resources/genome/fantom_enhancers.pg"); FantomEnhancerParser instance = new FantomEnhancerParser(inputFile, outputFile); instance.parse(); List<String> expected = Files.readAllLines(expectedOutputFile); List<String> actual = Files.readAllLines(outputFile); assertThat(actual, equalTo(expected)); }