PrefixJarResource implements Resource { @Override public URL getResource(String location) { URL result = null; try { location = prefix + location; JarEntry jarEntry = jarFile.getJarEntry(location); if (jarEntry != null) { result = new URL("jar: } } catch (MalformedURLException use) { } return result; } PrefixJarResource();  PrefixJarResource(JarFile jarFile, String prefix); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); Stream<String> getAllLocations(); JarFile getJarFile(); String getPrefix(); void setJarFile(JarFile jarFile); void setPrefix(String prefix);  }
@Test void testGetResource() { PrefixJarResource resource = new PrefixJarResource(); assertThrows(NullPointerException.class, () -> assertNull(resource.getResource(null))); }
@Test void testGetResource2() { PrefixJarResource resource = new PrefixJarResource(); assertThrows(NullPointerException.class, () -> resource.getResource("we_wont_find_this")); }