use of au.com.dius.pact.provider.PactVerifyProvider in project customer-service by wenqiglantz.
the class CustomerEventsPublishPactVerificationTest method publishCustomerWasDeleted.
@PactVerifyProvider("valid CustomerWasDeleted from provider")
public String publishCustomerWasDeleted() throws Exception {
String customerId = "595eed0c-eff5-4278-90ad-b952f18dbee8";
CustomerWasDeleted event = CustomerWasDeleted.builder().customerId(customerId).status(CustomerStatus.DELETED).build();
context.checking(new Expectations() {
{
oneOf(customerService).deleteCustomer(customerId);
}
});
customerService.deleteCustomer(customerId);
String eventString = objectMapper.writeValueAsString(event);
return eventString;
}
use of au.com.dius.pact.provider.PactVerifyProvider in project customer-service by wenqiglantz.
the class CustomerEventsPublishPactVerificationTest method publishCustomerWasUpdated.
@PactVerifyProvider("valid CustomerWasUpdated from provider")
public String publishCustomerWasUpdated() throws Exception {
CustomerInfo customerInfo = CustomerInfo.builder().customerId("595eed0c-eff5-4278-90ad-b952f18dbee8").firstName("test123").lastName("last").build();
CustomerWasUpdated event = CustomerWasUpdated.builder().customerId("595eed0c-eff5-4278-90ad-b952f18dbee8").firstName("test123").lastName("last").status(CustomerStatus.UPDATED).build();
context.checking(new Expectations() {
{
oneOf(customerService).updateCustomer(customerInfo.getCustomerId(), customerInfo);
}
});
customerService.updateCustomer(customerInfo.getCustomerId(), customerInfo);
String eventString = objectMapper.writeValueAsString(event);
return eventString;
}
use of au.com.dius.pact.provider.PactVerifyProvider in project EcommerceApp by teixeira-fernando.
the class CreateShipmentProviderPact method verifyMessageForOrderJson.
@PactVerifyProvider("Order in Json format")
public String verifyMessageForOrderJson() {
try {
String id = "1";
String productName = "Samsung TV Led";
Integer quantity = 50;
Category category = Category.ELECTRONICS;
Order order = new Order("1", new ArrayList<>());
order.getProducts().add(new Product(id, productName, quantity, category));
String body = mapper.writeValueAsString(order);
return body;
} catch (JsonProcessingException e) {
e.printStackTrace();
return null;
}
}
use of au.com.dius.pact.provider.PactVerifyProvider in project pay-connector by alphagov.
the class QueueMessageContractTest method verifyUserEmailCollectedEvent.
@PactVerifyProvider("a user email collected message")
public String verifyUserEmailCollectedEvent() throws JsonProcessingException {
ChargeEntity charge = aValidChargeEntity().withEmail("test@example.org").build();
UserEmailCollected userEmailCollected = new UserEmailCollected(charge.getServiceId(), charge.getGatewayAccount().isLive(), resourceId, UserEmailCollectedEventDetails.from(charge), ZonedDateTime.now());
return userEmailCollected.toJsonString();
}
use of au.com.dius.pact.provider.PactVerifyProvider in project pay-connector by alphagov.
the class QueueMessageContractTest method verifyRefundedEvent.
@PactVerifyProvider("a refund succeeded message")
public String verifyRefundedEvent() throws JsonProcessingException {
String gatewayTransactionId = RandomStringUtils.randomAlphanumeric(14);
ChargeEntity chargeEntity = aValidChargeEntity().build();
Charge charge = Charge.from(chargeEntity);
RefundHistory refundHistory = aValidRefundHistoryEntity().withStatus(RefundStatus.REFUNDED.getValue()).withGatewayTransactionId(gatewayTransactionId).build();
RefundSucceeded refundSucceeded = RefundSucceeded.from(charge, refundHistory);
return refundSucceeded.toJsonString();
}
Aggregations