Search in sources :

Example 1 with ChangeSuperClassFix

use of com.intellij.codeInspection.inheritance.ChangeSuperClassFix in project intellij-community by JetBrains.

the class SuperClassHasFrequentlyUsedInheritorsInspectionTest method doTest.

private void doTest(final int expectedSize) {
    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.enableInspections(SuperClassHasFrequentlyUsedInheritorsInspection.class);
    final Set<Pair<String, Integer>> actualSet = new HashSet<Pair<String, Integer>>();
    for (IntentionAction intentionAction : myFixture.getAvailableIntentions()) {
        if (intentionAction instanceof QuickFixWrapper) {
            ChangeSuperClassFix changeSuperClassFix = getQuickFixFromWrapper((QuickFixWrapper) intentionAction);
            if (changeSuperClassFix != null) {
                actualSet.add(Pair.create(changeSuperClassFix.getNewSuperClass().getQualifiedName(), changeSuperClassFix.getPercent()));
            }
        }
    }
    assertSize(expectedSize, actualSet);
}
Also used : ChangeSuperClassFix(com.intellij.codeInspection.inheritance.ChangeSuperClassFix) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) QuickFixWrapper(com.intellij.codeInspection.ex.QuickFixWrapper) HashSet(com.intellij.util.containers.HashSet) Pair(com.intellij.openapi.util.Pair)

Example 2 with ChangeSuperClassFix

use of com.intellij.codeInspection.inheritance.ChangeSuperClassFix in project intellij-community by JetBrains.

the class SuperClassHasFrequentlyUsedInheritorsInspectionTest method doTest.

private void doTest(final Pair<String, Integer>... expectedResults) {
    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.enableInspections(SuperClassHasFrequentlyUsedInheritorsInspection.class);
    final Set<Pair<String, Integer>> actualSet = new HashSet<Pair<String, Integer>>();
    for (IntentionAction intentionAction : myFixture.getAvailableIntentions()) {
        if (intentionAction instanceof QuickFixWrapper) {
            ChangeSuperClassFix changeSuperClassFix = getQuickFixFromWrapper((QuickFixWrapper) intentionAction);
            if (changeSuperClassFix != null) {
                actualSet.add(Pair.create(changeSuperClassFix.getNewSuperClass().getQualifiedName(), changeSuperClassFix.getPercent()));
            }
        }
    }
    final Set<Pair<String, Integer>> expectedSet = ContainerUtil.newHashSet(expectedResults);
    assertEquals(actualSet, expectedSet);
}
Also used : ChangeSuperClassFix(com.intellij.codeInspection.inheritance.ChangeSuperClassFix) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) QuickFixWrapper(com.intellij.codeInspection.ex.QuickFixWrapper) HashSet(com.intellij.util.containers.HashSet) Pair(com.intellij.openapi.util.Pair)

Aggregations

IntentionAction (com.intellij.codeInsight.intention.IntentionAction)2 QuickFixWrapper (com.intellij.codeInspection.ex.QuickFixWrapper)2 ChangeSuperClassFix (com.intellij.codeInspection.inheritance.ChangeSuperClassFix)2 Pair (com.intellij.openapi.util.Pair)2 HashSet (com.intellij.util.containers.HashSet)2