andi-huber commented on code in PR #2031:
URL: https://github.com/apache/causeway/pull/2031#discussion_r1398431646
##########
testing/integtestsupport/applib/src/main/java/org/apache/causeway/testing/integtestsupport/applib/_Helper.java:
##########
@@ -21,44 +21,56 @@
import java.util.Optional;
import org.junit.jupiter.api.extension.ExtensionContext;
+import org.springframework.context.ApplicationContext;
import
org.apache.causeway.applib.services.exceprecog.ExceptionRecognizerService;
import org.apache.causeway.applib.services.iactnlayer.InteractionContext;
import org.apache.causeway.applib.services.iactnlayer.InteractionService;
-import org.apache.causeway.applib.services.registry.ServiceRegistry;
+import org.apache.causeway.commons.internal.assertions._Assert;
import org.apache.causeway.commons.internal.reflection._Annotations;
+import org.apache.causeway.core.metamodel.context.MetaModelContext;
import
org.apache.causeway.testing.integtestsupport.applib.annotation.InteractAs;
import
org.apache.causeway.testing.integtestsupport.applib.annotation.InteractAsUtils;
class _Helper {
- static Optional<ServiceRegistry> getServiceRegistry(final ExtensionContext
extensionContext) {
+ static Optional<ApplicationContext> getSpringContext(final
ExtensionContext extensionContext) {
return extensionContext.getTestInstance()
- .filter(CausewayIntegrationTestAbstract.class::isInstance)
- .map(CausewayIntegrationTestAbstract.class::cast)
- .map(causewayIntegrationTestAbstract ->
causewayIntegrationTestAbstract.serviceRegistry);
+ .filter(CausewayIntegrationTestAbstract.class::isInstance)
+ .map(CausewayIntegrationTestAbstract.class::cast)
+ .map(causewayIntegrationTestAbstract ->
causewayIntegrationTestAbstract.springContext)
+ .map(springContext->{
+ var mmc = springContext.getBean(MetaModelContext.class);
+ _Assert.assertNotNull(mmc, ()->
+ "MetaModelContext not found on Spring's test
context.");
+ MetaModelContext.setOrReplace(mmc);
Review Comment:
Here's the actual fix!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]