@Test @SuppressWarnings("unchecked") public void testUndo() { command.execute(graphCommandExecutionContext); verify(propertyAdapter).getValue(eq(domainObject.getNameProperty())); verify(propertyAdapter).setValue(eq(domainObject.getNameProperty()), eq(PROPERTY_VALUE)); assertEquals(CommandResult.Type.INFO, command.undo(graphCommandExecutionContext).getType()); verify(propertyAdapter, times(2)).getValue(eq(domainObject.getNameProperty())); verify(propertyAdapter).setValue(eq(domainObject.getNameProperty()), eq(PROPERTY_OLD_VALUE)); }
@Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); }
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } }
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
                                                  final @MapsTo("field") String field,
                                                  final @MapsTo("value") Object value); }
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
                                                  final @MapsTo("field") String field,
                                                  final @MapsTo("value") Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString(); }
UpdateDomainObjectPropertyValueCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final UpdateDomainObjectPropertyValueCommand undoCommand = new UpdateDomainObjectPropertyValueCommand(domainObject, field, oldValue); return undoCommand.execute(context); } UpdateDomainObjectPropertyValueCommand(final @MapsTo("domainObject") DomainObject domainObject,
                                                  final @MapsTo("field") String field,
                                                  final @MapsTo("value") Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString();  }