Search in sources :

Example 1 with AddMethodQualifierFix

use of com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix in project intellij-community by JetBrains.

the class AddMethodQualifierTest method doTest.

private void doTest(final String... candidatesNames) {
    myFixture.configureByFile(getTestName(false) + ".java");
    final AddMethodQualifierFix addMethodQualifierFix = getQuickFix();
    if (candidatesNames.length == 0) {
        assertNull(addMethodQualifierFix);
        return;
    }
    assertNotNull(addMethodQualifierFix);
    final Set<String> actualCandidatesNames = new TreeSet<>(ContainerUtil.map(addMethodQualifierFix.getCandidates(), new Function<PsiNamedElement, String>() {

        @Override
        public String fun(final PsiNamedElement psiNamedElement) {
            final String name = psiNamedElement.getName();
            assertNotNull(name);
            return name;
        }
    }));
    final Set<String> expectedCandidatesNames = new TreeSet<>(ContainerUtil.list(candidatesNames));
    assertEquals(expectedCandidatesNames, actualCandidatesNames);
}
Also used : AddMethodQualifierFix(com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix) Function(com.intellij.util.Function) PsiNamedElement(com.intellij.psi.PsiNamedElement)

Example 2 with AddMethodQualifierFix

use of com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix in project intellij-community by JetBrains.

the class AddMethodQualifierTest method getQuickFix.

@Nullable
private AddMethodQualifierFix getQuickFix() {
    final List<IntentionAction> availableIntentions = myFixture.getAvailableIntentions();
    AddMethodQualifierFix addMethodQualifierFix = null;
    for (final IntentionAction availableIntention : availableIntentions) {
        if (availableIntention instanceof AddMethodQualifierFix) {
            addMethodQualifierFix = (AddMethodQualifierFix) availableIntention;
            break;
        }
    }
    return addMethodQualifierFix;
}
Also used : AddMethodQualifierFix(com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with AddMethodQualifierFix

use of com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix in project intellij-community by JetBrains.

the class AddMethodQualifierTest method doTestFix.

private void doTestFix() {
    myFixture.configureByFile(getTestName(false) + "Before.java");
    final AddMethodQualifierFix quickFix = getQuickFix();
    assertNotNull(quickFix);
    myFixture.launchAction(quickFix);
    myFixture.checkResultByFile(getTestName(false) + "After.java");
}
Also used : AddMethodQualifierFix(com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix)

Aggregations

AddMethodQualifierFix (com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix)3 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)1 PsiNamedElement (com.intellij.psi.PsiNamedElement)1 Function (com.intellij.util.Function)1 Nullable (org.jetbrains.annotations.Nullable)1