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