TrackFile { @NonNull public String getName() { return file.getName() .replaceAll(".csv.gz", "") .replaceAll("_", " "); } TrackFile(File file); @NonNull String getName(); @NonNull String getSize(); void archive(@NonNull File destination); @NonNull @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); final File file; }
@Test public void trackFileName() { TrackFile trackFile = new TrackFile(new File("track_2018-01-01_16-20-00.csv.gz")); assertEquals("track 2018-01-01 16-20-00", trackFile.getName()); }