Source:
<code>public void test() throws Exception { File outputDirectory = Files.createTempDirectory("example1").toFile(); copyDir(new File("resources/examples/example1"), outputDirectory); new File(outputDirectory, ".project").delete(); new File(outputDirectory, ".classpath").delete(); new File(outputDirectory, "module1/.project").delete(); new File(outputDirectory, "module1/.classpath").delete(); Set<IProject> newProjects = null; SmartImportJob job = new SmartImportJob(outputDirectory, Collections.EMPTY_SET, true, true); Map<File, List<ProjectConfigurator>> proposals = job.getImportProposals(monitor); Assert.assertEquals("Expected 2 projects to import", 2, proposals.size()); boolean thymConfiguratorFound = false; for(ProjectConfigurator configurator : proposals.values().iterator().next()) { if(configurator instanceof MavenProjectConfigurator) { thymConfiguratorFound = true; } } Assert.assertTrue("Maven configurator not found while checking directory", thymConfiguratorFound); job.setDirectoriesToImport(proposals.keySet()); IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); Set<IProject> beforeImport = new HashSet<>(Arrays.asList(wsRoot.getProjects())); job.run(monitor); job.join(); newProjects = new HashSet<>(Arrays.asList(wsRoot.getProjects())); newProjects.removeAll(beforeImport); Assert.assertEquals("Expected only 2 new projects", 2, newProjects.size()); waitForJobsToComplete(monitor); <START> UpdateMavenConfigurationJob.getInstance().join(); <END> for(IProject project : newProjects) { Assert .assertTrue(project.getLocation().toFile().getCanonicalPath().startsWith(outputDirectory.getCanonicalPath())); IMavenProjectFacade mavenProject = MavenPlugin.getMavenProjectRegistry().getProject(project); Assert.assertNotNull("Project not configured as Maven", mavenProject); } }</code><technical_language>job implement IBackgroundProcessingQueue</technical_language>

Target:
public void test() throws Exception { File outputDirectory = Files.createTempDirectory("example1").toFile(); copyDir(new File("resources/examples/example1"), outputDirectory); new File(outputDirectory, ".project").delete(); new File(outputDirectory, ".classpath").delete(); new File(outputDirectory, "module1/.project").delete(); new File(outputDirectory, "module1/.classpath").delete(); Set<IProject> newProjects = null; SmartImportJob job = new SmartImportJob(outputDirectory, Collections.EMPTY_SET, true, true); Map<File, List<ProjectConfigurator>> proposals = job.getImportProposals(monitor); Assert.assertEquals("Expected 2 projects to import", 2, proposals.size()); boolean thymConfiguratorFound = false; for(ProjectConfigurator configurator : proposals.values().iterator().next()) { if(configurator instanceof MavenProjectConfigurator) { thymConfiguratorFound = true; } } Assert.assertTrue("Maven configurator not found while checking directory", thymConfiguratorFound); job.setDirectoriesToImport(proposals.keySet()); IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); Set<IProject> beforeImport = new HashSet<>(Arrays.asList(wsRoot.getProjects())); job.run(monitor); job.join(); newProjects = new HashSet<>(Arrays.asList(wsRoot.getProjects())); newProjects.removeAll(beforeImport); Assert.assertEquals("Expected only 2 new projects", 2, newProjects.size()); waitForJobsToComplete(monitor); for(IProject project : newProjects) { Assert .assertTrue(project.getLocation().toFile().getCanonicalPath().startsWith(outputDirectory.getCanonicalPath())); IMavenProjectFacade mavenProject = MavenPlugin.getMavenProjectRegistry().getProject(project); Assert.assertNotNull("Project not configured as Maven", mavenProject); } }