You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/03/26 17:56:24 UTC

[causeway] branch master updated (3ca0b8a0f1 -> f1c3b8462f)

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git


    from 3ca0b8a0f1 CAUSEWAY-3397: adds new method in _Annotations
     new 240ecee920 CAUSEWAY-3397 : rewrites, adds unit tests
     new f1c3b8462f CAUSEWAY-3397 : updates InteractAs

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/internal/reflection/_Annotations.java  |  42 ++-
 .../Annotations_synthesizeElseOnClass_Test.java    | 286 +++++++++++++++++++++
 ...a => Annotations_synthesize_on_Class_Test.java} |   4 +-
 ...a => Annotations_synthesize_on_Field_Test.java} |   4 +-
 ... => Annotations_synthesize_on_Method_Test.java} |   4 +-
 ... Annotations_synthesize_on_Parameter_Test.java} |   4 +-
 .../testing/integtestsupport/applib/_Helper.java   |   2 +-
 .../applib/annotation/InteractAs.java              |   6 +-
 8 files changed, 329 insertions(+), 23 deletions(-)
 create mode 100644 core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesizeElseOnClass_Test.java
 rename core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/{Annotations_getAnnotations_on_Class_Test.java => Annotations_synthesize_on_Class_Test.java} (99%)
 rename core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/{Annotations_getAnnotations_on_Field_Test.java => Annotations_synthesize_on_Field_Test.java} (99%)
 rename core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/{Annotations_getAnnotations_on_Method_Test.java => Annotations_synthesize_on_Method_Test.java} (99%)
 rename core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/{Annotations_getAnnotations_on_Parameter_Test.java => Annotations_synthesize_on_Parameter_Test.java} (99%)


[causeway] 02/02: CAUSEWAY-3397 : updates InteractAs

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit f1c3b8462f4b292d7455301fbb6e6753c73f28dd
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Mar 26 18:55:52 2023 +0100

    CAUSEWAY-3397 : updates InteractAs
---
 .../testing/integtestsupport/applib/annotation/InteractAs.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/annotation/InteractAs.java b/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/annotation/InteractAs.java
index 6661c9659d..47c137da66 100644
--- a/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/annotation/InteractAs.java
+++ b/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/annotation/InteractAs.java
@@ -44,10 +44,14 @@ import org.apache.causeway.applib.services.iactnlayer.InteractionService;
  * }
  * </pre>
  *
+ * <p>
+ * It can also be applied to a class, meaning it will apply to all tests within that class.
+ * </p>
+ *
  * @since 2.0 {@index}
  */
 @Inherited
-@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
+@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE })
 @Retention(RetentionPolicy.RUNTIME)
 public @interface InteractAs {
 


[causeway] 01/02: CAUSEWAY-3397 : rewrites, adds unit tests

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 240ecee920952a69b76d491b7f12933e4b630e65
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Mar 26 18:55:14 2023 +0100

    CAUSEWAY-3397 : rewrites, adds unit tests
---
 .../commons/internal/reflection/_Annotations.java  |  42 ++-
 .../Annotations_synthesizeElseOnClass_Test.java    | 286 +++++++++++++++++++++
 ...a => Annotations_synthesize_on_Class_Test.java} |   4 +-
 ...a => Annotations_synthesize_on_Field_Test.java} |   4 +-
 ... => Annotations_synthesize_on_Method_Test.java} |   4 +-
 ... Annotations_synthesize_on_Parameter_Test.java} |   4 +-
 .../testing/integtestsupport/applib/_Helper.java   |   2 +-
 7 files changed, 324 insertions(+), 22 deletions(-)

diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java
index dcb916545d..c622caa097 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java
@@ -97,30 +97,40 @@ public final class _Annotations {
             final AnnotatedElement annotatedElement,
             final Class<A> annotationType) {
 
-        return synthesize(annotatedElement, annotationType, SearchStrategy.TYPE_HIERARCHY);
+        val collected = collect(annotatedElement, SearchStrategy.TYPE_HIERARCHY);
+
+        // also handle annotated fields, getter methods might be associated with
+        val associated =
+                annotatedFieldForAnnotatedElement(annotatedElement, annotationType)
+                        .map(fieldForGetter->collect(fieldForGetter, SearchStrategy.TYPE_HIERARCHY));
+
+        return _Annotations_SynthesizedMergedAnnotationInvocationHandler
+                .createProxy(collected, associated, annotationType);
     }
 
     /**
      * Optionally create a type-safe synthesized version of this annotation based on presence.
      * <p>
-     * Also includes annotated fields, getter methods might be associated with.
-     * If annotations from a getter method are competing with annotations from its corresponding field,
-     * let the one win, that is 'nearer' to the <i>Class</i> that is subject to introspection.
-     * <p>
      * Perform a full search of the entire type hierarchy,
      * including super-classes and implemented interfaces.p
      * Super-class annotations do not need to be meta-annotated with {@link Inherited}.
      *
      * @param <A>
-     * @param annotatedElement
+     * @param annotatedMethod
      * @param annotationType
      * @return non-null
      */
-    public static <A extends Annotation> Optional<A> synthesizeWrtEnclosingClass(
-            final AnnotatedElement annotatedElement,
+    public static <A extends Annotation> Optional<A> synthesizeConsideringClass(
+            final Method annotatedMethod,
             final Class<A> annotationType) {
 
-        return synthesize(annotatedElement, annotationType, SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES);
+        val collected = collect(annotatedMethod, SearchStrategy.TYPE_HIERARCHY);
+
+        // also handle containing class
+        val associatedClass = collect(annotatedMethod.getDeclaringClass(), SearchStrategy.TYPE_HIERARCHY);
+
+        return _Annotations_SynthesizedMergedAnnotationInvocationHandler
+                .createProxy(collected, Optional.of(associatedClass), annotationType);
     }
 
     /**
@@ -143,7 +153,15 @@ public final class _Annotations {
             final AnnotatedElement annotatedElement,
             final Class<A> annotationType) {
 
-        return synthesize(annotatedElement, annotationType, SearchStrategy.DIRECT);
+        val collected = collect(annotatedElement, SearchStrategy.DIRECT);
+
+        // also handle annotated fields, getter methods might be associated with
+        val associated =
+                annotatedFieldForAnnotatedElement(annotatedElement, annotationType)
+                        .map(fieldForGetter->collect(fieldForGetter, SearchStrategy.DIRECT));
+
+        return _Annotations_SynthesizedMergedAnnotationInvocationHandler
+                .createProxy(collected, associated, annotationType);
     }
 
     // -- HELPER
@@ -167,10 +185,8 @@ public final class _Annotations {
                 annotatedFieldForAnnotatedElement(annotatedElement, annotationType)
                         .map(fieldForGetter->collect(fieldForGetter, searchStrategy));
 
-        val proxyIfAny = _Annotations_SynthesizedMergedAnnotationInvocationHandler
+        return _Annotations_SynthesizedMergedAnnotationInvocationHandler
                 .createProxy(collected, associated, annotationType);
-
-        return proxyIfAny;
     }
 
     /**
diff --git a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesizeElseOnClass_Test.java b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesizeElseOnClass_Test.java
new file mode 100644
index 0000000000..6b5b85ac0a
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesizeElseOnClass_Test.java
@@ -0,0 +1,286 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.causeway.core.metamodel.facets;
+
+import lombok.val;
+
+import java.lang.annotation.*;
+
+import org.apache.causeway.commons.internal.reflection._Annotations;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class Annotations_synthesizeElseOnClass_Test {
+
+
+    @Inherited
+    @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface InteracAs { // cf @InteractAs
+        String usrName() default "";  // cf @InteractAs#userName
+    }
+
+    @InteracAs(usrName = "sven")
+    @Inherited
+    @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface InteracdAsSven {
+    }
+
+    @InteracAs(usrName = "joe")
+    @Inherited
+    @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface InteracdAsJoe {
+    }
+
+    @InteracdAsJoe
+    @Inherited
+    @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE })
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface MetaInteractAsJoe {
+    }
+
+
+    @Test
+    public void on_method() throws Exception {
+
+        class SomeTestCase {
+            @InteracAs(usrName = "sven")
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("sven"));
+    }
+
+    @Test
+    public void meta() throws Exception {
+
+        class SomeTestCase {
+            @InteracdAsJoe
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("joe"));
+    }
+
+    @Test
+    public void metaMeta() throws Exception {
+
+        class SomeTestCase {
+            @MetaInteractAsJoe
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("joe"));
+    }
+
+    @Test
+    public void meta_and_metaMeta() throws Exception {
+
+        class SomeTestCase {
+            @MetaInteractAsJoe
+            @InteracdAsJoe
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("joe"));
+    }
+
+    @Test
+    public void meta_overrides_metaMeta() throws Exception {
+
+        class SomeTestCase {
+            @MetaInteractAsJoe
+            @InteracdAsSven
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("sven"));
+    }
+
+    @Test
+    public void direct_overrides_metaMeta() throws Exception {
+
+        class SomeTestCase {
+            @MetaInteractAsJoe
+            @InteracdAsSven
+            @InteracAs(usrName = "bill")
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("bill"));
+    }
+
+
+    @Test
+    public void from_class() throws Exception {
+
+        @InteracAs(usrName = "bill")
+        class SomeTestCase {
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("bill"));
+    }
+
+    @Test
+    public void from_superclass() throws Exception {
+
+        @InteracAs(usrName = "bill")
+        class SomeSuperTestCase {
+        }
+
+        class SomeTestCase extends SomeSuperTestCase {
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("bill"));
+    }
+
+    @Test
+    public void class_overrides_from_superclass() throws Exception {
+
+        @InteracAs(usrName = "bill")
+        class SomeSuperTestCase {
+        }
+
+        @InteracAs(usrName = "fred")
+        class SomeTestCase extends SomeSuperTestCase {
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("fred"));
+    }
+
+    @Test
+    public void method_overrides_class() throws Exception {
+
+        @InteracAs(usrName = "fred")
+        class SomeTestCase  {
+            @InteracAs(usrName = "bill")
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("bill"));
+    }
+
+    @Test
+    public void meta_on_method_overrides_class() throws Exception {
+
+        @InteracAs(usrName = "fred")
+        class SomeTestCase  {
+            @InteracdAsJoe
+            public void test() {}
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("joe"));
+    }
+
+    @Test
+    public void local_class_overrides_method_on_superclass() throws Exception {
+
+        class SomeSuperClass  {
+            @InteracAs(usrName = "bill")
+            public void test() {}
+        }
+
+        @InteracdAsSven
+        class SomeTestCase extends SomeSuperClass {
+            public void test() {
+                super.test();
+            }
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("sven"));
+    }
+
+    @Test
+    public void meta_on_local_class_overrides_method_on_superclass() throws Exception {
+
+        class SomeSuperClass  {
+            @InteracAs(usrName = "bill")
+            public void test() {}
+        }
+
+        @MetaInteractAsJoe
+        class SomeTestCase extends SomeSuperClass {
+            public void test() {
+                super.test();
+            }
+        }
+
+        val method = SomeTestCase.class.getMethod("test");
+        val nearest = _Annotations.synthesizeConsideringClass(method, InteracAs.class);
+
+        assertThat(nearest.isPresent(), is(true));
+        assertThat(nearest.get().usrName(), is("joe"));
+    }
+
+}
diff --git a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Class_Test.java b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Class_Test.java
similarity index 99%
rename from core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Class_Test.java
rename to core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Class_Test.java
index bd55c80760..e76dbbadc8 100644
--- a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Class_Test.java
+++ b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Class_Test.java
@@ -35,7 +35,7 @@ import org.apache.causeway.commons.internal.reflection._Annotations;
 
 import lombok.val;
 
-public class Annotations_getAnnotations_on_Class_Test {
+public class Annotations_synthesize_on_Class_Test {
 
 
     @Inherited
@@ -245,4 +245,4 @@ public class Annotations_getAnnotations_on_Class_Test {
 
 
 
-}
\ No newline at end of file
+}
diff --git a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Field_Test.java b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Field_Test.java
similarity index 99%
rename from core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Field_Test.java
rename to core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Field_Test.java
index 1de802b4fa..437c0217ce 100644
--- a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Field_Test.java
+++ b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Field_Test.java
@@ -36,7 +36,7 @@ import org.apache.causeway.commons.internal.reflection._Annotations;
 import lombok.val;
 
 @SuppressWarnings("unused")
-public class Annotations_getAnnotations_on_Field_Test {
+public class Annotations_synthesize_on_Field_Test {
 
 
     @Property(executionPublishing = Publishing.ENABLED)
@@ -200,4 +200,4 @@ public class Annotations_getAnnotations_on_Field_Test {
         assertThat(nearestM.get().executionPublishing(), is(Publishing.ENABLED));
     }
 
-}
\ No newline at end of file
+}
diff --git a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Method_Test.java b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Method_Test.java
similarity index 99%
rename from core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Method_Test.java
rename to core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Method_Test.java
index 45e06204a9..54cb4c5a61 100644
--- a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Method_Test.java
+++ b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Method_Test.java
@@ -33,7 +33,7 @@ import org.apache.causeway.commons.internal.reflection._Annotations;
 
 import lombok.val;
 
-public class Annotations_getAnnotations_on_Method_Test {
+public class Annotations_synthesize_on_Method_Test {
 
 
     @Inherited
@@ -181,4 +181,4 @@ public class Annotations_getAnnotations_on_Method_Test {
         assertThat(nearest.get().publishng(), is(DomainObj.Publishng.YES));
     }
 
-}
\ No newline at end of file
+}
diff --git a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Parameter_Test.java b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Parameter_Test.java
similarity index 99%
rename from core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Parameter_Test.java
rename to core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Parameter_Test.java
index cf90f383fb..4916d5c07b 100644
--- a/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_getAnnotations_on_Parameter_Test.java
+++ b/core/metamodel/src/test/java/org/apache/causeway/core/metamodel/facets/Annotations_synthesize_on_Parameter_Test.java
@@ -34,7 +34,7 @@ import org.apache.causeway.commons.internal.reflection._Annotations;
 import lombok.val;
 
 @SuppressWarnings("unused")
-public class Annotations_getAnnotations_on_Parameter_Test {
+public class Annotations_synthesize_on_Parameter_Test {
 
 
     @Inherited
@@ -197,4 +197,4 @@ public class Annotations_getAnnotations_on_Parameter_Test {
         assertThat(nearest.get().publishng(), is(DomainObj.Publishng.YES));
     }
 
-}
\ No newline at end of file
+}
diff --git a/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/_Helper.java b/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/_Helper.java
index e70013c62a..360e8b6bc6 100644
--- a/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/_Helper.java
+++ b/testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/_Helper.java
@@ -44,7 +44,7 @@ class _Helper {
      */
     static Optional<InteractionContext> getCustomInteractionContext(final ExtensionContext extensionContext) {
         return extensionContext.getTestMethod()
-        .flatMap(testMethod->_Annotations.synthesize(testMethod, InteractAs.class))
+        .flatMap(testMethod->_Annotations.synthesizeConsideringClass(testMethod, InteractAs.class))
         .map(InteractAsUtils::toInteractionContext);
     }