public final class AddAddress extends UpdateActionImpl<Customer>
See also CustomerInStoreUpdateCommand.
withCustomer(client(), customer -> { final String city = "addAddress"; final Address newAddress = AddressBuilder.of(DE).city(city).build(); final Predicate<Address> containsNewAddressPredicate = a -> a.getCity().equals(city); assertThat(customer.getAddresses().stream() .anyMatch(containsNewAddressPredicate)) .overridingErrorMessage("address is not present, yet") .isFalse(); final Customer updatedCustomer = client().executeBlocking(CustomerUpdateCommand.of(customer, AddAddress.of(newAddress))); assertThat(updatedCustomer.getAddresses().stream() .anyMatch(containsNewAddressPredicate)).isTrue(); Query<CustomerAddressAddedMessage> messageQuery = MessageQuery.of() .withPredicates(m -> m.resource().is(customer)) .withSort(m -> m.createdAt().sort().desc()) .withLimit(1L) .forMessageType(CustomerAddressAddedMessage.MESSAGE_HINT); assertEventually(() -> { final PagedQueryResult<CustomerAddressAddedMessage> queryResult = client().executeBlocking(messageQuery); assertThat(queryResult.head()).isPresent(); }); });
See the test code.
Modifier and Type | Method and Description |
---|---|
Address |
getAddress() |
static AddAddress |
of(Address address) |
getAction
public static AddAddress of(Address address)
public Address getAddress()