void (@NotNull PsiMethod method) { super.visitMethod(method); final PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, "org.testng.annotations.Test"); if (annotation == null) { return; } final PsiAnnotationMemberValue value = annotation.findDeclaredAttributeValue("expectedExceptions"); if (value == null) { return; } final PsiCodeBlock body = method.getBody(); if (body == null) { return; } final List<PsiClassType> exceptionsThrown = ExceptionUtil.getThrownExceptions(body); if (value instanceof PsiClassObjectAccessExpression) { checkAnnotationMemberValue(value, method, exceptionsThrown); } else if (value instanceof PsiArrayInitializerMemberValue arrayInitializerMemberValue) { for (PsiAnnotationMemberValue memberValue : arrayInitializerMemberValue.getInitializers()) { checkAnnotationMemberValue(memberValue, method, exceptionsThrown); } } }