blob: 59683ae56fcc1415160c2f818369ab70b6381f2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.AnnotateMethodFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.nullable.NullableStuffInspection;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiMethod;
import org.jetbrains.annotations.NonNls;
public class AnnotateMethodTest extends LightQuickFix15TestCase {
private boolean myMustBeAvailableAfterInvoke;
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/annotateMethod";
}
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[]{new NullableStuffInspection(){
@Override
protected AnnotateMethodFix createAnnotateMethodFix(String defaultNotNull, String[] annotationsToRemove) {
return new AnnotateMethodFix(defaultNotNull, annotationsToRemove){
@Override
public int annotateBaseMethod(final PsiMethod method, final PsiMethod superMethod, final Project project) {
@NonNls String name = method.getName();
int ret = name.startsWith("annotateBase") ? 0 // yes, annotate all
: name.startsWith("dontAnnotateBase") ? 1 // do not annotate base
: 2; //abort
myMustBeAvailableAfterInvoke = ret == 2;
return ret;
}
};
}
}};
}
@Override
protected boolean shouldBeAvailableAfterExecution() {
return myMustBeAvailableAfterInvoke;
}
public void test() throws Exception { doAllTests(); }
}
|