Closed ramsimmin closed 1 year ago
That looks like a mismatch with Spring versions. What version of Spring/Springboot are you using?
I'm using spring boot 3.1.4
For Springboot 3, you need to use au.com.dius.pact.provider:spring6
Thanks @rholshausen , instead of au.com.dius.pact.provider:junit5spring:4.6.3
I've used
testImplementation 'au.com.dius.pact.provider:spring6:4.6.3'
testImplementation 'au.com.dius.pact.provider:junit5:4.6.3'
Changing the test to make use of the PactVerificationSpring6Provider.class worked! Here's my updated test:
@Provider("provider-app")
@PactFolder("pacts")
@ExtendWith({SpringExtension.class})
@SpringBootTest
@AutoConfigureWebTestClient
class ConsumerPactTestsWebflux {
@Autowired
WebTestClient webTestClient;
@Autowired
TicketController ticketController;
@TestTemplate
@ExtendWith(PactVerificationSpring6Provider.class)
void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
@BeforeEach
void before(PactVerificationContext context) {
context.setTarget(new WebTestClientSpring6Target(webTestClient));
}
@State({"Create ticket"})
public void verifyTicketCreation() { }
}
Hello, I'm trying to verify my Reactive RestContoller in a spring boot application with no success. Basically, my consumer (consumer1-app) expects a 200 OK success response when posting to the provider's (provider-app) endpoint "/api/ticket/create", thus my consumer contract looks like this:
In the provider's side, I have a simple rest controller, returning an empty Mono for now.
Testing this via curl returns http status 200 OK:
After placing the contract file into the pacts folder, I have tried to create my pact verification test as follows:
and it fails with NoSuchMethodError:
These are my dependencies (on the providers side):
Is there any way to test my annotated reactive controller? Any help/guidance would be appreciated.