microcks / microcks-testcontainers-java

Java lib for Testcontainers that enables embedding Microcks into your JUnit tests with lightweight, throwaway instance thanks to containers.
https://microcks.io
Apache License 2.0
18 stars 3 forks source link

Provide a fallback method for running a test when you don't have access to MicrocksContainer instance #10

Closed lbroudoux closed 11 months ago

lbroudoux commented 11 months ago

Reason/Context

As working on the integration of Microcks as a DevService for Quarkus, it appears that it's difficult to have access to the MicrocksContainer devservice instance. This instance was initialized during the augmentation phase and - for the moment - I don't find any way of injecting it into the CDI context for later consumption by the unit tests.

As a consequence, the unit cannot invoke microcksContainer.testEndpoint(testRequest) because of the null instance.

Description

As the Quarkus unit test as access to the URL where the container is running that way:

@ConfigProperty(name= "quarkus.microcks.default")
String microcksContainerUrl;

we could propose a fallback where a static method of MicrocksContainer is used with an extra argument that is actually this microcksContainerUrl which is the Http endpoint.

Implementation ideas

No response