@Test public void createFileSameNameDifferentExtension() { File testFile = new File("/some/path/file.txt"); String newExtension = "jpg"; File result = new RichFile(testFile).createFileSameNameDifferentExtension(newExtension); assertThat(result.getAbsolutePath()).matches("[A-Z]:\\\\some\\\\path\\\\file\\.jpg|/some/path/file\\.jpg"); }
public File createFileSameNameDifferentExtension(String extension) { String newName = getNameWithoutExtension() + "." + extension; return new RichFile(file.getParentFile()).createChildFile(newName); }
RichFile { public File createFileSameNameDifferentExtension(String extension) { String newName = getNameWithoutExtension() + "." + extension; return new RichFile(file.getParentFile()).createChildFile(newName); } }
RichFile { public File createFileSameNameDifferentExtension(String extension) { String newName = getNameWithoutExtension() + "." + extension; return new RichFile(file.getParentFile()).createChildFile(newName); } RichFile(File file); }
RichFile { public File createFileSameNameDifferentExtension(String extension) { String newName = getNameWithoutExtension() + "." + extension; return new RichFile(file.getParentFile()).createChildFile(newName); } RichFile(File file); void writeStringToFile(String content); void writeInputStream(final InputStream stream); String getStringFromFile(); boolean deleteDirectory(); boolean deleteFile(); File createChildFile(String childName); File createFileSameNameDifferentExtension(String extension); String getNameWithoutExtension(); String getExtension(); }
RichFile { public File createFileSameNameDifferentExtension(String extension) { String newName = getNameWithoutExtension() + "." + extension; return new RichFile(file.getParentFile()).createChildFile(newName); } RichFile(File file); void writeStringToFile(String content); void writeInputStream(final InputStream stream); String getStringFromFile(); boolean deleteDirectory(); boolean deleteFile(); File createChildFile(String childName); File createFileSameNameDifferentExtension(String extension); String getNameWithoutExtension(); String getExtension();  }