import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
@ExtendWith(PactConsumerTestExt.class)
@PactTestFor(providerName = "UsersProvider")
public class RemoteUsersServiceConsumerIT
{
@ExtendWith(PactConsumerTestExt.class)
@PactTestFor(providerName = "UsersProvider")
public class RemoteUsersServiceConsumerIT
{
@Pact(consumer="EmailServicesConsumer")
public RequestResponsePact getExistingUserByEmail(PactDslWithProvider builder) {
return builder
@Pact(consumer="EmailServicesConsumer")
public RequestResponsePact getExistingUserByEmail(PactDslWithProvider builder) {
return builder
@Test
@PactTestFor(pactMethod = "getExistingUserByEmail")
public void testGetExistingUserByEmail(MockServer mockServer) {
@Test
@PactTestFor(pactMethod = "getExistingUserByEmail")
public void testGetExistingUserByEmail(MockServer mockServer) {
try {
Optional<User> result = usersService.getUserByEmail("pact@juplo.de");
assertThat(result.isPresent()).isTrue();
User user = result.get();
try {
Optional<User> result = usersService.getUserByEmail("pact@juplo.de");
assertThat(result.isPresent()).isTrue();
User user = result.get();