JUnit5 provider test with broker integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
@Provider("UserServiceJUnit5") | |
@PactBroker(url = "http://localhost:9292") | |
@SetSystemProperty(key = "pact.verifier.publishResults", value = "true") | |
public class PactProviderJUnit5WithBrokerTest { | |
@LocalServerPort | |
int port; | |
@BeforeEach | |
public void setup(PactVerificationContext context) { | |
context.setTarget(new HttpTestTarget("localhost", port)); | |
} | |
@State("A running user service") | |
void setupUserService() { | |
// no state setup ATM | |
} | |
@TestTemplate | |
@ExtendWith(PactVerificationInvocationContextProvider.class) | |
void pactVerificationTestTemplate(PactVerificationContext context) { | |
context.verifyInteraction(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment