### Question:
DefaultPluginTransformer implements PluginTransformer { File addFilesToExistingZip(File zipFile, Map<String, byte[]> files) throws IOException { File tempFile = new File(bundleCacheDir, generateCacheName(zipFile)); byte[] buf = new byte[1024]; ZipInputStream zin = null; ZipOutputStream out = null; try { zin = new ZipInputStream(new FileInputStream(zipFile)); out = new ZipOutputStream(new FileOutputStream(tempFile)); ZipEntry entry = zin.getNextEntry(); while (entry != null) { String name = entry.getName(); if (!files.containsKey(name)) { out.putNextEntry(new ZipEntry(name)); int len; while ((len = zin.read(buf)) > 0) out.write(buf, 0, len); } entry = zin.getNextEntry(); } zin.close(); for (Map.Entry<String, byte[]> fentry : files.entrySet()) { InputStream in = null; try { in = new ByteArrayInputStream(fentry.getValue()); out.putNextEntry(new ZipEntry(fentry.getKey())); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); } finally { IOUtils.closeQuietly(in); } } out.close(); } finally { IOUtils.closeQuietly(zin); IOUtils.closeQuietly(out); } return tempFile; } DefaultPluginTransformer(OsgiPersistentCache cache, SystemExports systemExports, Set<String> applicationKeys, String pluginDescriptorPath,
                                    OsgiContainerManager osgiContainerManager);  DefaultPluginTransformer(OsgiPersistentCache cache, SystemExports systemExports, Set<String> applicationKeys, String pluginDescriptorPath,
                                    OsgiContainerManager osgiContainerManager, List<TransformStage> stages); File transform(File pluginJar, List<HostComponentRegistration> regs); File transform(PluginArtifact pluginArtifact, List<HostComponentRegistration> regs);  }### Answer:
@Test public void testAddFilesToZip() throws URISyntaxException, IOException { final File file = PluginTestUtils.getFileForResource("myapp-1.0-plugin.jar"); final Map<String, byte[]> files = new HashMap<String, byte[]>() { { put("foo", "bar".getBytes()); } }; final File copy = transformer.addFilesToExistingZip(file, files); assertNotNull(copy); assertTrue(!copy.getName().equals(file.getName())); assertTrue(copy.length() != file.length()); final ZipFile zip = new ZipFile(copy); final ZipEntry entry = zip.getEntry("foo"); assertNotNull(entry); }