BedFiles { public static Stream<ChromosomalRegion> readChromosomalRegions(Path bedPath) { try { return Files.lines(bedPath) .filter(nonHeaderLine()) .map(toChromosomalRegion()); } catch (IOException ex) { throw new BedFileParseException("Unable to read file " + bedPath, ex); } } private  BedFiles(); static Stream<ChromosomalRegion> readChromosomalRegions(Path bedPath);  }
@Test public void readChromosomalRegions() { List<ChromosomalRegion> expectedIntervals = new ArrayList<>(); expectedIntervals.add(new GeneticInterval(7, 127471197, 127472363)); expectedIntervals.add(new GeneticInterval(7, 127472364, 127473530)); expectedIntervals.add(new GeneticInterval(7, 127475865, 127477031)); expectedIntervals.add(new GeneticInterval(7, 127479366, 127480532)); expectedIntervals.add(new GeneticInterval(7, 127480533, 127481699)); Stream<ChromosomalRegion> regions = BedFiles.readChromosomalRegions(Paths.get("src/test/resources/intervals.bed")); assertThat(regions.collect(toList()), contains(expectedIntervals.toArray())); }