use of org.kie.workbench.common.dmn.client.commands.general.SetHasValueCommand in project kie-wb-common by kiegroup.
the class ExpressionContainerGridTest method testSpyHasNameUpdateUndoWithSetHasNameCommand.
@Test
public void testSpyHasNameUpdateUndoWithSetHasNameCommand() {
grid.setExpression(NODE_UUID, hasExpression, Optional.of(hasName), false);
final Optional<HasName> spy = grid.spyHasName(Optional.of(hasName));
final Name newName = new Name("new-name");
final Name oldName = spy.get().getName();
final org.uberfire.mvp.Command canvasOperation = mock(org.uberfire.mvp.Command.class);
final SetHasValueCommand command = new SetHasValueCommand<>(spy.get(), newName, canvasOperation);
command.execute(canvasHandler);
spy.ifPresent(name -> assertThat(name.getName().getValue()).isEqualTo(newName.getValue()));
command.undo(canvasHandler);
spy.ifPresent(name -> assertThat(name.getName().getValue()).isEqualTo(oldName.getValue()));
}
Aggregations