PackageLocator { static URI stripSchemes(final URI uri) { URI schemeStrippedUri = uri; while (schemeStrippedUri.getScheme() != null) { schemeStrippedUri = URI.create(schemeStrippedUri.getRawSchemeSpecificPart()); } return schemeStrippedUri; } PackageLocator();   PackageLocator(final ClassPropertyAccessor classPropertyAccessor); File locatePackage(final Class clazz);  }
@Test public void stripSchemes_zeroSchemes() throws Exception { final URI uri = URI.create("/PATH.xyz.jar"); final URI actual = PackageLocator.stripSchemes(uri); Assert.assertEquals(URI.create("/PATH.xyz.jar"), actual); }
@Test public void stripSchemes_oneScheme() throws Exception { final URI uri = URI.create("file:/PATH.xyz.jar"); final URI actual = PackageLocator.stripSchemes(uri); Assert.assertEquals(URI.create("/PATH.xyz.jar"), actual); }
@Test public void stripSchemes_oneSchemeWithJarBoundary() throws Exception { final URI uri = URI.create("file:/PATH.xyz.jar!/classpath.class"); final URI actual = PackageLocator.stripSchemes(uri); Assert.assertEquals(URI.create("/PATH.xyz.jar!/classpath.class"), actual); }
@Test public void stripSchemes_twoSchemes() throws Exception { final URI uri = URI.create("jar:file:/PATH.xyz.jar!/classpath.class"); final URI actual = PackageLocator.stripSchemes(uri); Assert.assertEquals(URI.create("/PATH.xyz.jar!/classpath.class"), actual); }