### Question:
DependenciesDeployer { static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) { XMLOutputFactory xof = XMLOutputFactory.newInstance(); xof.setProperty("javax.xml.stream.isRepairingNamespaces", true); XMLStreamWriter sw = null; try { sw = xof.createXMLStreamWriter(writer); sw.writeStartDocument("UTF-8", "1.0"); sw.setDefaultNamespace(KARAF_FEATURE_NS); sw.writeCharacters("\n"); sw.writeStartElement("features"); sw.writeAttribute("name", "test-dependencies"); sw.writeCharacters("\n"); sw.writeStartElement("feature"); sw.writeAttribute("name", "test-dependencies"); sw.writeCharacters("\n"); for (ProvisionOption<?> provisionOption : provisionOptions) { if (provisionOption.getURL().startsWith("link") || provisionOption.getURL().startsWith("scan-features")) { continue; } sw.writeStartElement("bundle"); if (provisionOption.getStartLevel() != null) { sw.writeAttribute("start-level", provisionOption.getStartLevel().toString()); } sw.writeCharacters(provisionOption.getURL()); endElement(sw); } endElement(sw); endElement(sw); sw.writeEndDocument(); } catch (XMLStreamException e) { throw new RuntimeException("Error writing feature " + e.getMessage(), e); } finally { close(sw); } } DependenciesDeployer(ExamSystem subsystem, File karafBase, File karafHome); void copyBootClasspathLibraries(); void copyReferencedArtifactsToDeployFolder(); KarafFeaturesOption getDependenciesFeature();  }### Answer:
@Test public void testEncoding() { WrappedUrlProvisionOption option = wrappedBundle(mavenBundle("mygroup", "myArtifactId", "1.0")); option.instructions("Export-Package=my.package.*"); option.overwriteManifest(OverwriteMode.MERGE); StringWriter wr = new StringWriter(); DependenciesDeployer.writeDependenciesFeature(wr, option); Assert.assertThat(wr.toString(), StringContains.containsString("<bundle>wrap:mvn:mygroup/myArtifactId/1.0$overwrite=MERGE&amp;Export-Package=my.package.*</bundle>")); }
@Test public void testDependencyFeature() { MavenArtifactProvisionOption option = mavenBundle().groupId("mygroup").artifactId("myArtifactId").version("1.0"); StringWriter wr = new StringWriter(); DependenciesDeployer.writeDependenciesFeature(wr, option); Assert.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<features xmlns=\"http: "<feature name=\"test-dependencies\">\n" + "<bundle>mvn:mygroup/myArtifactId/1.0</bundle>\n" + "</feature>\n" + "</features>\n", wr.toString()); }
@Test public void testDependencyFeatureWithBundleStartLevel() { MavenArtifactProvisionOption option = mavenBundle().groupId("mygroup").artifactId("myArtifactId").version("1.0").startLevel(42); StringWriter wr = new StringWriter(); DependenciesDeployer.writeDependenciesFeature(wr, option); Assert.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<features xmlns=\"http: "<feature name=\"test-dependencies\">\n" + "<bundle start-level=\"42\">mvn:mygroup/myArtifactId/1.0</bundle>\n" + "</feature>\n" + "</features>\n", wr.toString()); }