use of com.intellij.codeInsight.generation.PsiMethodWithOverridingPercentMember in project intellij-community by JetBrains.
the class JavaMethodsOverridingStatisticsTest method doTest.
private void doTest(final int resultSize, final Pair<String, Integer>... expectedValues) {
myFixture.configureByFile(getTestName(false) + ".java");
final PsiClass contextClass = OverrideImplementUtil.getContextClass(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile(), true);
assert contextClass != null;
if (OverrideImplementExploreUtil.getMethodSignaturesToOverride(contextClass).isEmpty() && expectedValues.length != 0) {
fail();
}
final Collection<CandidateInfo> candidateInfos = OverrideImplementExploreUtil.getMethodsToOverrideImplement(contextClass, false);
final PsiMethodWithOverridingPercentMember[] searchResults = PsiMethodWithOverridingPercentMember.calculateOverridingPercents(candidateInfos);
assertSize(resultSize, searchResults);
final Set<Pair<String, Integer>> actualValues = new HashSet<>();
for (PsiMethodWithOverridingPercentMember searchResult : searchResults) {
actualValues.add(Pair.<String, Integer>create(searchResult.getElement().getName(), searchResult.getOverridingPercent()));
}
final Set<Pair<String, Integer>> expectedValuesSet = ContainerUtil.newHashSet(expectedValues);
assertEquals(expectedValuesSet, actualValues);
}
Aggregations