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 15:46:02 UTC

[causeway] 02/02: CAUSEWAY-3397: updates InteractAs, and call within _Helper to new use _Annotations API

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

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

commit 19a04055ee6614818dcfe30a6e3e0ce8f4a85b7c
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Mar 26 16:35:26 2023 +0100

    CAUSEWAY-3397: updates InteractAs, and call within _Helper to new use _Annotations API
---
 .../apache/causeway/testing/integtestsupport/applib/_Helper.java    | 2 +-
 .../testing/integtestsupport/applib/annotation/InteractAs.java      | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

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..9c32e6d385 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.synthesizeWrtEnclosingClass(testMethod, InteractAs.class))
         .map(InteractAsUtils::toInteractionContext);
     }
 
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 {