void (PsiModifierList beforeModifierList, PsiModifierList afterModifierList) { if (shouldCompareAnnotations()) { Collection<String> beforeAnnotations = Arrays.stream(beforeModifierList.getAnnotations()) .map(PsiAnnotation::getQualifiedName) .filter(Pattern.compile("lombok.*").asPredicate().negate().or(LombokClassNames.NON_NULL::equals)) .filter(Pattern.compile(annotationToComparePattern()).asPredicate()) .filter(Predicate.not(annotationsToIgnoreList()::contains)) .toList(); Collection<String> afterAnnotations = Arrays.stream(afterModifierList.getAnnotations()) .map(PsiAnnotation::getQualifiedName) .filter(Pattern.compile(annotationToComparePattern()).asPredicate()) .filter(Predicate.not(annotationsToIgnoreList()::contains)) .toList(); assertTrue("Annotations are different for " + afterModifierList.getParent() + ": " + beforeAnnotations + "/" + afterAnnotations, beforeAnnotations.size() == afterAnnotations.size() && beforeAnnotations.containsAll(afterAnnotations) && afterAnnotations.containsAll(beforeAnnotations)); // compare annotations parameter list for (PsiAnnotation beforeAnnotation : beforeModifierList.getAnnotations()) { String qualifiedName = beforeAnnotation.getQualifiedName(); PsiAnnotation afterAnnotation = afterModifierList.findAnnotation(qualifiedName); if (null != afterAnnotation) { Map<String, String> beforeParameter = Stream.of(beforeAnnotation.getParameterList().getAttributes()) .collect(Collectors.toMap(PsiNameValuePair::getAttributeName, p -> p.getValue().getText())); Map<String, String> afterParameter = Stream.of(afterAnnotation.getParameterList().getAttributes()) .collect(Collectors.toMap(PsiNameValuePair::getAttributeName, p -> p.getValue().getText())); assertEquals("Annotation parameter are not same for " + qualifiedName, afterParameter, beforeParameter); } } } }