### Question:
ScoreCardServiceLoaderImpl implements ScoreCardServiceLoader { public Set<String> find(final Path path, final String packageName) { final Set<String> result = new HashSet<>(); try { final WorkspaceProject workspaceProject = projectService.resolveProject(path); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindScorecardNamesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new ValueSharedPartIndexTerm( "*", PartType.SCORECARD_MODEL_NAME, ValueIndexTerm.TermSearchType.WILDCARD)); add(new ValueModuleRootPathIndexTerm( workspaceProject.getMainModule().getRootPath().toURI())); add(new ValuePackageNameIndexTerm( packageName)); }}); for (RefactoringPageRow row : rows) { result.add(row.getValue().toString()); } } finally { return result; } }  Set<String> find(final Path path,
                            final String packageName);  }### Answer:
@Test public void find() { final org.uberfire.java.nio.file.Path root = fileSystemProvider.getPath(URI.create("default: final Path path = Paths.convert(root); final WorkspaceProject workspaceProject = mock(WorkspaceProject.class); final Module module = mock(Module.class); doReturn(module).when(workspaceProject).getMainModule(); doReturn(workspaceProject).when(projectService).resolveProject(path); doReturn(path).when(module).getRootPath(); final ArrayList<RefactoringPageRow> rows = new ArrayList<>(); final RefactoringStringPageRow row1 = new RefactoringStringPageRow(); row1.setValue("row1"); rows.add(row1); final RefactoringStringPageRow row2 = new RefactoringStringPageRow(); row2.setValue("row2"); rows.add(row2); doReturn(rows).when(refactoringQueryService).query(eq(FindScorecardNamesQuery.NAME), termsCaptor.capture()); final Set<String> result = scoreCardServiceLoader.find(path, "org.test"); assertTerms(termsCaptor.getValue()); assertEquals(2, result.size()); assertTrue(result.contains("row1")); assertTrue(result.contains("row2")); }
@Test public void noProject() { final org.uberfire.java.nio.file.Path root = fileSystemProvider.getPath(URI.create("default: final Path path = Paths.convert(root); doThrow(new IllegalArgumentException()).when(projectService).resolveProject(path); final Set<String> result = scoreCardServiceLoader.find(path, "org.test"); verify(refactoringQueryService, never()).query(eq(FindScorecardNamesQuery.NAME), any()); assertEquals(0, result.size()); }