@Test public void getExtensionNoDots() { assertThat(new RichFile(new File("/dir/nesteddir/filename")).getExtension()).isEqualTo(""); }
public String getExtension() { String name = file.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot != -1) { return name.substring(lastDot+1); } else { return ""; } }
RichFile { public String getExtension() { String name = file.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot != -1) { return name.substring(lastDot+1); } else { return ""; } } }
RichFile { public String getExtension() { String name = file.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot != -1) { return name.substring(lastDot+1); } else { return ""; } } RichFile(File file); }
RichFile { public String getExtension() { String name = file.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot != -1) { return name.substring(lastDot+1); } else { return ""; } } 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 String getExtension() { String name = file.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot != -1) { return name.substring(lastDot+1); } else { return ""; } } 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();  }