AnalyzeBundle { static List<Export> exportedPackages(File jarFile) { try { Optional<Manifest> jarManifest = JarFiles.getManifest(jarFile); if (jarManifest.isPresent()) { Manifest manifest = jarManifest.get(); if (isOsgiManifest(manifest)) { return parseExports(manifest); } } return Collections.emptyList(); } catch (Exception e) { throw new RuntimeException(String.format("Invalid manifest in bundle '%s'", jarFile.getPath()), e); } }  static List<Export> exportedPackagesAggregated(Collection<File> jarFiles); static Optional<String> bundleSymbolicName(File jarFile);  }
@Test public void require_that_invalid_exports_throws_exception() { exception.expect(Exception.class); exception.expectMessage(containsString("Invalid manifest in bundle")); exception.expectMessage(matchesPattern("Invalid manifest in bundle '.*errorExport.jar'")); exception.expectCause(throwableMessage(startsWith("Failed parsing Export-Package"))); AnalyzeBundle.exportedPackages(jarFile("errorExport.jar")); }