From 90335bd0a6bb84918a426d6d6be01f2a7b4c2dc5 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Wed, 31 Jul 2024 13:19:44 -0600 Subject: [PATCH] Polish Annotation Test This test was made more effective by having it focus on the real scenario of resolving annotations from the standpoint of a bean --- .../UniqueMergedAnnotationSynthesizerTests.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/springframework/security/core/annotation/UniqueMergedAnnotationSynthesizerTests.java b/core/src/test/java/org/springframework/security/core/annotation/UniqueMergedAnnotationSynthesizerTests.java index 2df5d7362a..0728cd6383 100644 --- a/core/src/test/java/org/springframework/security/core/annotation/UniqueMergedAnnotationSynthesizerTests.java +++ b/core/src/test/java/org/springframework/security/core/annotation/UniqueMergedAnnotationSynthesizerTests.java @@ -71,9 +71,8 @@ public class UniqueMergedAnnotationSynthesizerTests { @Test void synthesizeWhenInterfaceOverridingMultipleInterfaceInheritanceThenResolves() throws Exception { - Method method = InterfaceOverridingMultipleInterfaceInheritance.class.getMethod("method"); - PreAuthorize preAuthorize = this.synthesizer.synthesize(method, - InterfaceOverridingMultipleInterfaceInheritance.class); + Method method = ClassInheritingInterfaceOverridingMultipleInterfaceInheritance.class.getDeclaredMethod("method"); + PreAuthorize preAuthorize = this.synthesizer.synthesize(method); assertThat(preAuthorize.value()).isEqualTo("ten"); } @@ -311,6 +310,14 @@ public class UniqueMergedAnnotationSynthesizerTests { } + private static class ClassInheritingInterfaceOverridingMultipleInterfaceInheritance + implements InterfaceOverridingMultipleInterfaceInheritance { + @Override + public String method() { + return "ok"; + } + } + private interface InterfaceMethodOverridingMultipleInterfaceInheritance extends AnnotationOnInterface, AlsoAnnotationOnInterface {