Source:
public void testImportLibs() throws IOException, InvocationTargetException, InterruptedException { final File tmpJarFileWhichWillBeCopied1 = File.createTempFile("testImport1-", ".jar"); Files.copy(this.getClass().getResourceAsStream("test.jar"), tmpJarFileWhichWillBeCopied1.toPath(), StandardCopyOption.REPLACE_EXISTING); final File tmpJarFileWhichWillBeCopied2 = File.createTempFile("testImport2-", ".jar"); Files.copy(this.getClass().getResourceAsStream("test.jar"), tmpJarFileWhichWillBeCopied2.toPath(), StandardCopyOption.REPLACE_EXISTING); final File tmpFileWhichWillBeCopied1 = File.createTempFile("testImport1-", ".zip"); Files.copy(this.getClass().getResourceAsStream("test.zip"), tmpFileWhichWillBeCopied1.toPath(), StandardCopyOption.REPLACE_EXISTING); final File tmpFileWhichWillBeCopied2 = File.createTempFile("testImport2-", ".zip"); Files.copy(this.getClass().getResourceAsStream("test-2.zip"), tmpFileWhichWillBeCopied2.toPath(), StandardCopyOption.REPLACE_EXISTING); final String[] jarAndZips = new String[] { tmpFileWhichWillBeCopied1.toString(), tmpFileWhichWillBeCopied2.toString(), tmpJarFileWhichWillBeCopied1.toString(), tmpJarFileWhichWillBeCopied2.toString() }; final DependencyRepositoryStore libStore = RepositoryManager.getInstance().getRepositoryStore(DependencyRepositoryStore.class); final ImportLibsRunnable importLibsRunnable = new ImportLibsRunnable(libStore, jarAndZips, ""); importLibsRunnable.run(new NullProgressMonitor()); assertThat(libStore.getChild("test.jar")).isNotNull(); assertThat(libStore.getChild("test2.jar")).isNotNull(); assertThat(libStore.getChild("test-2.jar")).isNotNull(); assertThat(libStore.getChild("test2-2.jar")).isNotNull(); assertThat(libStore.getChild(tmpJarFileWhichWillBeCopied1.getName())).isNotNull(); assertThat(libStore.getChild(tmpJarFileWhichWillBeCopied2.getName())).isNotNull(); }

Target:
public void testImportLibs() throws IOException, InvocationTargetException, InterruptedException { final File tmpJarFileWhichWillBeCopied1 = tmpFolder.newFile("testjar.jar"); FileUtil.copy(this.getClass().getResourceAsStream("test.jar"), new FileOutputStream(tmpJarFileWhichWillBeCopied1)); final File tmpJarFileWhichWillBeCopied2 = tmpFolder.newFile("test2jar.jar");; FileUtil.copy(this.getClass().getResourceAsStream("test.jar"), new FileOutputStream(tmpJarFileWhichWillBeCopied2)); final File tmpFileWhichWillBeCopied1 = tmpFolder.newFile("test.zip"); FileUtil.copy(this.getClass().getResourceAsStream("test.zip"), new FileOutputStream(tmpFileWhichWillBeCopied1)); final File tmpFileWhichWillBeCopied2 = tmpFolder.newFile("test-2.zip"); FileUtil.copy(this.getClass().getResourceAsStream("test-2.zip"), new FileOutputStream(tmpFileWhichWillBeCopied2)); final String[] jarAndZips = new String[] { tmpFileWhichWillBeCopied1.toString(), tmpFileWhichWillBeCopied2.toString(), tmpJarFileWhichWillBeCopied1.toString(), tmpJarFileWhichWillBeCopied2.toString() }; final DependencyRepositoryStore libStore = RepositoryManager.getInstance().getRepositoryStore(DependencyRepositoryStore.class); final ImportLibsOperation importLibsRunnable = new ImportLibsOperation(libStore, jarAndZips, ""); importLibsRunnable.run(new NullProgressMonitor()); assertThat(libStore.getChild("test.jar")).isNotNull(); assertThat(libStore.getChild("test2.jar")).isNotNull(); assertThat(libStore.getChild("test-2.jar")).isNotNull(); assertThat(libStore.getChild("test2-2.jar")).isNotNull(); assertThat(libStore.getChild(tmpJarFileWhichWillBeCopied1.getName())).isNotNull(); assertThat(libStore.getChild(tmpJarFileWhichWillBeCopied2.getName())).isNotNull(); }