FileEntryService { String[] dividePathAndFile(String path) { int lastIndexOf = path.lastIndexOf("/"); if (lastIndexOf == -1) { return new String[]{"", path}; } else { return new String[]{path.substring(0, lastIndexOf), path.substring(lastIndexOf + 1)}; } }  @PostConstruct void init(); void invalidateCache(String userId); @Async void prepare(User user); void createGitHubConfig(User user); boolean existGitHubConfig(User user); @Cacheable(value = CACHE_FILE_ENTRIES, key = "#user.userId") List<FileEntry> getAll(User user); List<FileEntry> getAll(User user, String path, Long revision); FileEntry getOne(User user, String path, Long revision); FileEntry getOne(User user, String path); boolean hasFileEntry(User user, String path); void addFolder(User user, String path, String folderName, String comment); void save(User user, FileEntry fileEntry); void delete(User user, List<String> fullPathFiles); void delete(User user, String path); FileEntry prepareNewEntry(User user, String path, String fileName, String name, String url,
	                                 ScriptHandler scriptHandler, boolean libAndResource, String options); FileEntry prepareNewEntryForQuickTest(User user, String url, ScriptHandler scriptHandler); String loadTemplate(User user, ScriptHandler handler, String url, String name,
		String options); void writeContentTo(User user, String fromPath, File toDir); ScriptHandler getScriptHandler(FileEntry scriptEntry); ScriptHandler getScriptHandler(String key);  }
@Test public void testPathDivide() { String[] dividePathAndFile = fileEntryService.dividePathAndFile("helloworld.com/hello"); assertThat(dividePathAndFile[0], is("helloworld.com")); assertThat(dividePathAndFile[1], is("hello")); dividePathAndFile = fileEntryService.dividePathAndFile("helloworld.com"); assertThat(dividePathAndFile[0], is("")); assertThat(dividePathAndFile[1], is("helloworld.com")); }