### Question:
TemporaryNiogitService { public void importProjects(Path actualTarget) { OrganizationalUnit ou = ouService.createOrganizationalUnit(OU_NAME, "org.migration", Collections.emptyList(), Collections.singletonList(new Contributor(OU_OWNER, ContributorType.OWNER))); String repositoryURL = actualTarget.toUri().toString(); RepositoryEnvironmentConfigurations configurations = new RepositoryEnvironmentConfigurations(); Map<String, Object> configMap = configurations.getConfigurationMap(); configMap.put(EnvironmentParameters.AVOID_INDEX, "true"); configMap.put("origin", repositoryURL); Repository repo = repoService.createRepository(ou, GitRepository.SCHEME.toString(), TMP_REPO_ALIAS, configurations); WorkspaceProject project = projectService.resolveProject(repo); migrationService.migrate(project); repoService.removeRepository(ou.getSpace(), TMP_REPO_ALIAS); } @Inject  TemporaryNiogitService(OrganizationalUnitService ouService,
                                  RepositoryService repoService,
                                  WorkspaceProjectService projectService,
                                  WorkspaceProjectMigrationService migrationService); void importProjects(Path actualTarget);  }### Answer:
@Test public void removeMigrationRepoAfterMigration() throws Exception { service.importProjects(target); verify(repoService).removeRepository(eq(new Space(OU_NAME)), eq(TMP_REPO_ALIAS)); }
@Test public void migrateCalledOnLegacyProject() throws Exception { service.importProjects(target); verify(migrationService).migrate(projectCaptor.capture()); WorkspaceProject migrated = projectCaptor.getValue(); assertEquals(TMP_REPO_ALIAS, migrated.getRepository().getAlias()); }
@Test public void repoConfigurationHasOriginAndAvoidIndex() throws Exception { service.importProjects(target); verify(repoService).createRepository(any(), any(), any(), configsCaptor.capture()); RepositoryEnvironmentConfigurations configs = configsCaptor.getValue(); assertEquals(target.toUri().toString(), assertValue(configs.getOrigin(), String.class)); assertEquals("true", configs.getConfigurationMap().get(AVOID_INDEX)); }