FileEntryService { String getPathFromUrl(String urlString) { try { URL url = new URL(urlString); String urlPath = "/".equals(url.getPath()) ? "" : url.getPath(); return (url.getHost() + urlPath).replaceAll("[;\\&\\?\\%\\$\\-\\#]", "_"); } catch (MalformedURLException e) { throw processException("Error while translating " + urlString, e); } }  @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 testFileNameFromUrl() { assertThat(fileEntryService.getPathFromUrl("http: assertThat(fileEntryService.getPathFromUrl("http: assertThat(fileEntryService.getPathFromUrl("http: assertThat(fileEntryService.getPathFromUrl("http: assertThat(fileEntryService.getPathFromUrl("http: assertThat(fileEntryService.getPathFromUrl("http: is("helloworld.com/wewe.nhn")); }
@Test(expected = NGrinderRuntimeException.class) public void testFileNameFromInvalidUrl() { fileEntryService.getPathFromUrl("htt22p: }