boolean () { PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); PsiField field = Optional.ofNullable(PsiTreeUtil.getParentOfType(elementAtCaret, PsiField.class)) .orElseGet(() -> PsiTreeUtil.findChildOfType(myFixture.getFile(), PsiField.class)); if (field == null) { return false; } return ContainerUtil.and(expectedAnnotations, field::hasAnnotation) && field.getAnnotations().length == expectedAnnotations.size() && Arrays.stream(field.getAnnotations()).map(LombokProcessorUtil::getMethodModifier).allMatch(expectedAnnotationAccessLevel::equals); }