@Generated(value="io.sphere.sdk.annotations.processors.generators.UpdateActionsGenerator", comments="Generated from: io.sphere.sdk.customers.Customer") public final class ChangeEmail extends UpdateActionImpl<Customer>
email
property of a Customer
.
withCustomer(client(), customer -> {
final String newEmail = randomEmail(CustomerUpdateCommandIntegrationTest.class);
assertThat(customer.getEmail()).isNotEqualTo(newEmail);
final Customer updatedCustomer = client().executeBlocking(CustomerUpdateCommand.of(customer, ChangeEmail.of(newEmail)));
assertThat(updatedCustomer.getEmail()).isEqualTo(newEmail);
Query<CustomerEmailChangedMessage> messageQuery = MessageQuery.of()
.withPredicates(m -> m.resource().is(customer))
.withSort(m -> m.createdAt().sort().desc())
.withLimit(1L)
.forMessageType(CustomerEmailChangedMessage.MESSAGE_HINT);
assertEventually(() -> {
final PagedQueryResult<CustomerEmailChangedMessage> queryResult = client().executeBlocking(messageQuery);
assertThat(queryResult.head()).isPresent();
final CustomerEmailChangedMessage message = queryResult.head().get();
assertThat(message.getEmail()).isEqualTo(newEmail);
});
});
See the test code.
Customer.getEmail()
Modifier and Type | Method and Description |
---|---|
String |
getEmail() |
static ChangeEmail |
of(String email)
Creates a new update action from the given parameters.
|
getAction
public String getEmail()
public static ChangeEmail of(String email)
email
- the email
property Customer.getEmail()
.ChangeEmail
update action.