public final class RevertStagedChanges extends UpdateActionImpl<Product>
See also ProductUpdateCommand.
withUpdateableProduct(client(), product -> { //changing only staged and not current final LocalizedString oldDescriptionOption = product.getMasterData().getStaged().getDescription(); final LocalizedString newDescription = LocalizedString.ofEnglish("new description " + RANDOM.nextInt()); final ProductUpdateCommand cmd = ProductUpdateCommand.of(product, asList(Publish.of(), SetDescription.of(newDescription))); final Product updatedProduct = client().executeBlocking(cmd); assertThat(oldDescriptionOption).isNotEqualTo(newDescription); assertThat(updatedProduct.getMasterData().getStaged().getDescription()).isEqualTo(newDescription); assertThat(updatedProduct.getMasterData().getCurrent().getDescription()).isEqualTo(oldDescriptionOption); final Product revertedProduct = client().executeBlocking(ProductUpdateCommand.of(updatedProduct, RevertStagedChanges.of())); assertThat(revertedProduct.getMasterData().getStaged().getDescription()).isEqualTo(oldDescriptionOption); assertThat(revertedProduct.getMasterData().getCurrent().getDescription()).isEqualTo(oldDescriptionOption); return revertedProduct; });
See the test code.
Modifier and Type | Method and Description |
---|---|
static RevertStagedChanges |
of() |
getAction
public static RevertStagedChanges of()