SystemPackageExtrapolator { static String getPackageName( JarEntry jarEntry ) { String name = jarEntry.getName(); int lastSlash = name.lastIndexOf( '/' ); if ( lastSlash >= 0 ) { return name.substring( 0, lastSlash ).replaceAll( "\\/", "." ); } return ""; } SystemPackageExtrapolator();  SystemPackageExtrapolator(
      List<PackageProvider> providers ); Properties expandProperties( Properties properties ); static final String ORG_OSGI_FRAMEWORK_SYSTEM_PACKAGES_EXTRA; }
@Test public void testGetPackageName() { assertEquals( "com.test.name", SystemPackageExtrapolator.getPackageName( new JarEntry( "com/test/name/bob.class" ) ) ); assertEquals( "com.test.name", SystemPackageExtrapolator.getPackageName( new JarEntry( "com/test/name/" ) ) ); assertEquals( "", SystemPackageExtrapolator.getPackageName( new JarEntry( "/" ) ) ); assertEquals( "bob", SystemPackageExtrapolator.getPackageName( new JarEntry( "bob/" ) ) ); assertEquals( "", SystemPackageExtrapolator.getPackageName( new JarEntry( "bob.class" ) ) ); }