### Question:
UpdateElementPropertyValueCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final Element<Definition<?>> element = (Element<Definition<?>>) getNullSafeElement(context); final Object p = context.getDefinitionManager().adapters().forDefinition().getProperty(element.getContent().getDefinition(), field).get(); final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) context.getDefinitionManager().adapters().registry().getPropertyAdapter(p.getClass()); oldValue = adapter.getValue(p); adapter.setValue(p, value); return GraphCommandResultBuilder.SUCCESS; } UpdateElementPropertyValueCommand(final @MapsTo("elementUUID") String elementUUID,
                                             final @MapsTo("field") String field,
                                             final @MapsTo("value") Object value);  UpdateElementPropertyValueCommand(final Element<?> element,
                                             final String propertyId,
                                             final Object value); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Object getOldValue(); String getField(); Object getValue(); Element<?> getElement(); @Override String toString();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<Bounds> bounds = ArgumentCaptor.forClass(Bounds.class); assertEquals(CommandResult.Type.INFO, result.getType()); assertEquals(PROPERTY_OLD_VALUE, tested.getOldValue()); verify(propertyAdapter, times(1)).getValue(eq(property)); verify(propertyAdapter, times(1)).setValue(eq(property), eq(PROPERTY_VALUE)); }
@Test(expected = BadCommandArgumentsException.class) public void testExecuteNodeNotFound() { when(graphIndex.get(eq(UUID))).thenReturn(null); tested.execute(graphCommandExecutionContext); }