### Question:
OsgiHeaderUtil { public static String findReferredPackages(List<HostComponentRegistration> registrations) throws IOException { return findReferredPackages(registrations, Collections.<String, String>emptyMap()); }  static String findReferredPackages(List<HostComponentRegistration> registrations); static String findReferredPackages(List<HostComponentRegistration> registrations, Map<String, String> packageVersions); static Map<String, Map<String, String>> parseHeader(String header); static String buildHeader(String key, Map<String, String> attrs); static String getPluginKey(Bundle bundle); static String getPluginKey(Manifest mf);  }### Answer:
@Test public void testFindReferredPackages() throws IOException { String foundPackages = OsgiHeaderUtil.findReferredPackages(new ArrayList<HostComponentRegistration>() {{ add(new StubHostComponentRegistration(OsgiHeaderUtil.class)); }}); assertTrue(foundPackages.contains(HostComponentRegistration.class.getPackage().getName())); }
@Test public void testFindReferredPackagesWithVersion() throws IOException { String foundPackages = OsgiHeaderUtil.findReferredPackages(new ArrayList<HostComponentRegistration>() {{ add(new StubHostComponentRegistration(OsgiHeaderUtil.class)); }}, Collections.singletonMap(HostComponentRegistration.class.getPackage().getName(), "1.0")); assertTrue(foundPackages.contains(HostComponentRegistration.class.getPackage().getName() + ";version=1.0")); }