### Question:
RegistryAwareCommandManager implements SessionCommandManager<AbstractCanvasHandler> { @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { final Command<AbstractCanvasHandler, CanvasViolation> lastEntry = getCommandRegistry() .map(Registry::pop) .orElse(null); if (null != lastEntry) { return undo(context, lastEntry); } return CanvasCommandResultBuilder.failed(); } RegistryAwareCommandManager(); @SuppressWarnings("unchecked") RegistryAwareCommandManager init(final ClientSession session); CommandResult<CanvasViolation> allow(final Command<AbstractCanvasHandler, CanvasViolation> command); CommandResult<CanvasViolation> execute(final Command<AbstractCanvasHandler, CanvasViolation> command); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); CommandResult<CanvasViolation> undo(); @Override CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context,
                                                final Command<AbstractCanvasHandler, CanvasViolation> command); @Override CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context,
                                                  final Command<AbstractCanvasHandler, CanvasViolation> command); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context,
                                               final Command<AbstractCanvasHandler, CanvasViolation> command); @Override void start(); @Override void rollback(); @Override void complete(); @PreDestroy void destroy();  }### Answer:
@Test public void testUndo() { commandRegistry.register(COMMAND_SUCCESS1); tested.undo(); verify(commandManager, times(1)).undo(eq(canvasHandler), eq(COMMAND_SUCCESS1)); verify(commandManager, never()).execute(any(), any()); verify(commandManager, never()).allow(any(), any()); verify(commandRegistry, times(1)).pop(); }