@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("org.pkg1"); rows.add(row1); final RefactoringStringPageRow row2 = new RefactoringStringPageRow(); row2.setValue("org.test.pkg2"); rows.add(row2); doReturn(rows).when(refactoringQueryService).query(eq(FindPackageNamesQuery.NAME), termsCaptor.capture()); final Set<String> result = packageServiceLoader.find(path); assertTerms(termsCaptor.getValue()); assertEquals(2, result.size()); assertTrue(result.contains("org.pkg1")); assertTrue(result.contains("org.test.pkg2")); }
public Set<String> find(final Path path) { final Set<String> result = new HashSet<>(); try { final WorkspaceProject workspaceProject = projectService.resolveProject(path); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME, getValueIndexTerms(workspaceProject)); for (RefactoringPageRow row : rows) { result.add(row.getValue().toString()); } } catch (Exception e) { return result; } return result; }
PackageServiceLoaderImpl implements PackageServiceLoader { public Set<String> find(final Path path) { final Set<String> result = new HashSet<>(); try { final WorkspaceProject workspaceProject = projectService.resolveProject(path); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME, getValueIndexTerms(workspaceProject)); for (RefactoringPageRow row : rows) { result.add(row.getValue().toString()); } } catch (Exception e) { return result; } return result; } }
PackageServiceLoaderImpl implements PackageServiceLoader { public Set<String> find(final Path path) { final Set<String> result = new HashSet<>(); try { final WorkspaceProject workspaceProject = projectService.resolveProject(path); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME, getValueIndexTerms(workspaceProject)); for (RefactoringPageRow row : rows) { result.add(row.getValue().toString()); } } catch (Exception e) { return result; } return result; }  }
PackageServiceLoaderImpl implements PackageServiceLoader { public Set<String> find(final Path path) { final Set<String> result = new HashSet<>(); try { final WorkspaceProject workspaceProject = projectService.resolveProject(path); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME, getValueIndexTerms(workspaceProject)); for (RefactoringPageRow row : rows) { result.add(row.getValue().toString()); } } catch (Exception e) { return result; } return result; }  Set<String> find(final Path path); }
PackageServiceLoaderImpl implements PackageServiceLoader { public Set<String> find(final Path path) { final Set<String> result = new HashSet<>(); try { final WorkspaceProject workspaceProject = projectService.resolveProject(path); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME, getValueIndexTerms(workspaceProject)); for (RefactoringPageRow row : rows) { result.add(row.getValue().toString()); } } catch (Exception e) { return result; } return result; }  Set<String> find(final Path path);  }