@Test public void When_GetNameDBIsCalled_Expect_CorrectStringReturned() { assertThat(stringMethods.getNameDB(TEST_PATH), is("file_name")); }
public String getNameDB(final String path) { if (path.length() < EXTENSION.length() || !path.substring(path.length() - EXTENSION.length(), path.length()).equals(EXTENSION)) { return path.substring(path.lastIndexOf('/') + 1, path.length()); } return path.substring(path.lastIndexOf('/') + 1, path.length() - EXTENSION.length()); }
StringMethods { public String getNameDB(final String path) { if (path.length() < EXTENSION.length() || !path.substring(path.length() - EXTENSION.length(), path.length()).equals(EXTENSION)) { return path.substring(path.lastIndexOf('/') + 1, path.length()); } return path.substring(path.lastIndexOf('/') + 1, path.length() - EXTENSION.length()); } }
StringMethods { public String getNameDB(final String path) { if (path.length() < EXTENSION.length() || !path.substring(path.length() - EXTENSION.length(), path.length()).equals(EXTENSION)) { return path.substring(path.lastIndexOf('/') + 1, path.length()); } return path.substring(path.lastIndexOf('/') + 1, path.length() - EXTENSION.length()); } private  StringMethods(); }
StringMethods { public String getNameDB(final String path) { if (path.length() < EXTENSION.length() || !path.substring(path.length() - EXTENSION.length(), path.length()).equals(EXTENSION)) { return path.substring(path.lastIndexOf('/') + 1, path.length()); } return path.substring(path.lastIndexOf('/') + 1, path.length() - EXTENSION.length()); } private  StringMethods(); static StringMethods getInstance(); String fixPath(final String path); String checkExtension(final String path); String getNameDB(final String path); static boolean containsIgnoreCase(String str, String searchStr); }
StringMethods { public String getNameDB(final String path) { if (path.length() < EXTENSION.length() || !path.substring(path.length() - EXTENSION.length(), path.length()).equals(EXTENSION)) { return path.substring(path.lastIndexOf('/') + 1, path.length()); } return path.substring(path.lastIndexOf('/') + 1, path.length() - EXTENSION.length()); } private  StringMethods(); static StringMethods getInstance(); String fixPath(final String path); String checkExtension(final String path); String getNameDB(final String path); static boolean containsIgnoreCase(String str, String searchStr); static final String DEFAULT_FOLDER; }