Search in sources :

Example 1 with GuavaInspection

use of com.intellij.refactoring.typeMigration.inspections.GuavaInspection in project intellij-community by JetBrains.

the class GuavaInspectionTest method doTest.

private void doTest() {
    myFixture.configureByFile(getTestName(true) + ".java");
    myFixture.enableInspections(new GuavaInspection());
    boolean actionFound = false;
    myFixture.doHighlighting();
    for (IntentionAction action : myFixture.getAvailableIntentions()) {
        if (action instanceof GuavaInspection.MigrateGuavaTypeFix) {
            myFixture.launchAction(action);
            actionFound = true;
            break;
        }
    }
    assertTrue("Quick fix isn't found", actionFound);
    myFixture.checkResultByFile(getTestName(true) + "_after.java");
}
Also used : GuavaInspection(com.intellij.refactoring.typeMigration.inspections.GuavaInspection) IntentionAction(com.intellij.codeInsight.intention.IntentionAction)

Example 2 with GuavaInspection

use of com.intellij.refactoring.typeMigration.inspections.GuavaInspection in project intellij-community by JetBrains.

the class GuavaInspectionTest method doTestAllFile.

private void doTestAllFile() {
    myFixture.configureByFile(getTestName(true) + ".java");
    myFixture.enableInspections(new GuavaInspection());
    for (HighlightInfo info : myFixture.doHighlighting()) if (GuavaInspection.PROBLEM_DESCRIPTION.equals(info.getDescription())) {
        final Pair<HighlightInfo.IntentionActionDescriptor, RangeMarker> marker = info.quickFixActionMarkers.get(0);
        final PsiElement someElement = myFixture.getFile().findElementAt(0);
        assertNotNull(someElement);
        final List<IntentionAction> options = marker.getFirst().getOptions(someElement, myFixture.getEditor());
        assertNotNull(options);
        boolean doBreak = false;
        for (IntentionAction option : options) {
            if (option instanceof CleanupInspectionIntention) {
                myFixture.launchAction(option);
                doBreak = true;
                break;
            }
        }
        if (doBreak) {
            break;
        }
    }
    myFixture.checkResultByFile(getTestName(true) + "_after.java");
}
Also used : GuavaInspection(com.intellij.refactoring.typeMigration.inspections.GuavaInspection) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) HighlightInfo(com.intellij.codeInsight.daemon.impl.HighlightInfo) List(java.util.List) PsiElement(com.intellij.psi.PsiElement) CleanupInspectionIntention(com.intellij.codeInspection.actions.CleanupInspectionIntention) Pair(com.intellij.openapi.util.Pair)

Example 3 with GuavaInspection

use of com.intellij.refactoring.typeMigration.inspections.GuavaInspection in project intellij-community by JetBrains.

the class GuavaInspectionTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    myInspection = new GuavaInspection();
    myFixture.enableInspections(myInspection);
}
Also used : GuavaInspection(com.intellij.refactoring.typeMigration.inspections.GuavaInspection)

Aggregations

GuavaInspection (com.intellij.refactoring.typeMigration.inspections.GuavaInspection)3 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)2 HighlightInfo (com.intellij.codeInsight.daemon.impl.HighlightInfo)1 CleanupInspectionIntention (com.intellij.codeInspection.actions.CleanupInspectionIntention)1 Pair (com.intellij.openapi.util.Pair)1 PsiElement (com.intellij.psi.PsiElement)1 List (java.util.List)1