use of com.intellij.psi.PsiModifierList in project google-cloud-intellij by GoogleCloudPlatform.
the class RestSignatureInspectionTest method initializePsiMethod.
private void initializePsiMethod(String methodName, String httpMethodValue, String pathValue) {
PsiAnnotationMemberValue mockAnnotationMemberValue1 = mock(PsiAnnotationMemberValue.class);
when(mockAnnotationMemberValue1.getText()).thenReturn(httpMethodValue);
PsiAnnotationMemberValue mockAnnotationMemberValue2 = mock(PsiAnnotationMemberValue.class);
when(mockAnnotationMemberValue2.getText()).thenReturn(pathValue);
PsiAnnotation mockAnnotation = mock(PsiAnnotation.class);
when(mockAnnotation.getQualifiedName()).thenReturn(GctConstants.APP_ENGINE_ANNOTATION_API_METHOD);
when(mockAnnotation.findAttributeValue("httpMethod")).thenReturn(mockAnnotationMemberValue1);
when(mockAnnotation.findAttributeValue("path")).thenReturn(mockAnnotationMemberValue2);
PsiAnnotation[] mockAnnotationsArray = { mockAnnotation };
PsiModifierList mockModifierList = mock(PsiModifierList.class);
when(mockModifierList.getAnnotations()).thenReturn(mockAnnotationsArray);
mockPsiMethod = mock(PsiMethod.class);
when(mockPsiMethod.getModifierList()).thenReturn(mockModifierList);
when(mockPsiMethod.getName()).thenReturn(methodName);
when(mockPsiMethod.getContainingClass()).thenReturn(mockPsiClass);
PsiParameterList mockParameterList = mock(PsiParameterList.class);
when(mockParameterList.getParameters()).thenReturn(new PsiParameter[0]);
when(mockPsiMethod.getParameterList()).thenReturn(mockParameterList);
}
use of com.intellij.psi.PsiModifierList in project intellij by bazelbuild.
the class TestSizeAnnotationMap method getTestSize.
@Nullable
public static TestSize getTestSize(PsiClass psiClass) {
PsiModifierList psiModifierList = psiClass.getModifierList();
if (psiModifierList == null) {
return null;
}
PsiAnnotation[] annotations = psiModifierList.getAnnotations();
TestSize testSize = getTestSize(annotations);
if (testSize == null) {
return null;
}
return testSize;
}
use of com.intellij.psi.PsiModifierList in project intellij by bazelbuild.
the class GuiceImplicitUsageProvider method isImplicitUsage.
@Override
public boolean isImplicitUsage(PsiElement element) {
if (!(element instanceof PsiMethod)) {
return false;
}
PsiMethod method = (PsiMethod) element;
if (method.hasModifierProperty(PsiModifier.PRIVATE)) {
return false;
}
PsiModifierList modifiers = method.getModifierList();
return IMPLICIT_METHOD_USAGE_ANNOTATIONS.stream().anyMatch(s -> modifiers.findAnnotation(s) != null);
}
Aggregations