UiUtil { public static String getPathForFile(final String filename, final ClassSpace space) { for ( Enumeration<URL> e = space.findEntries("static", filename, true); e.hasMoreElements(); ) { URL url = e.nextElement(); return url.getPath(); } return null; }  static String getPathForFile(final String filename, final ClassSpace space);  }
@Test public void getHashedFilename() throws Exception { Enumeration<URL> mockedResponse = enumeration(asList( new File("/nexus-frontend-bundle.js").toURI().toURL() )); when(space.findEntries("static", "nexus-frontend-bundle.js", true)).thenReturn(mockedResponse); String hashedFilename = UiUtil.getPathForFile("nexus-frontend-bundle.js", space); assertThat(hashedFilename, is("/nexus-frontend-bundle.js")); }