void (String pattern, String... expected) { List<String> actual = new ArrayList<>(); StringBuilder s; for (MavenArtifactSearchResult eachResult : new MavenArtifactSearcher().search(myProject, pattern, 100)) { for (MavenDependencyCompletionItem eachVersion : eachResult.getSearchResults().getItems()) { s = new StringBuilder(); s.append(eachVersion.getGroupId()).append(":").append(eachVersion.getArtifactId()).append(":").append(eachVersion.getVersion()); actual.add(s.toString()); } } assertUnorderedElementsAreEqual(actual, expected); }