@Test public void generatesNamesWhenFileWithExtensionGiven() throws Exception { File file = new File(directory, "abc.txt"); String pathPrefix = directory.getAbsolutePath() + File.separatorChar; SplitFileNameGenerator generator = new SplitFileNameGenerator(file); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-1.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-2.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-3.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-4.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-5.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-6.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-7.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-8.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-9.txt")); assertThat(generator.nextFile().getAbsolutePath(), equalTo(pathPrefix + "abc-10.txt")); }
public File nextFile() { String suffix = Integer.toString(fileCount.incrementAndGet()); return addFileNameSuffix(baseFileName, suffix); }
SplitFileNameGenerator { public File nextFile() { String suffix = Integer.toString(fileCount.incrementAndGet()); return addFileNameSuffix(baseFileName, suffix); } }
SplitFileNameGenerator { public File nextFile() { String suffix = Integer.toString(fileCount.incrementAndGet()); return addFileNameSuffix(baseFileName, suffix); } SplitFileNameGenerator(File baseFileName); }
SplitFileNameGenerator { public File nextFile() { String suffix = Integer.toString(fileCount.incrementAndGet()); return addFileNameSuffix(baseFileName, suffix); } SplitFileNameGenerator(File baseFileName); File nextFile(); }
SplitFileNameGenerator { public File nextFile() { String suffix = Integer.toString(fileCount.incrementAndGet()); return addFileNameSuffix(baseFileName, suffix); } SplitFileNameGenerator(File baseFileName); File nextFile(); static final String SUFFIX_SEPARATOR; }