ScenarioCommandRegistryManager extends AbstractCommandRegistryManager<AbstractScenarioGridCommand> { protected void setUndoRedoButtonStatus(final ScenarioSimulationContext scenarioSimulationContext) { scenarioSimulationContext.setUndoButtonEnabledStatus(!doneCommandsRegistry.isEmpty()); scenarioSimulationContext.setRedoButtonEnabledStatus(!undoneCommandsRegistry.isEmpty()); }  void register(ScenarioSimulationContext context, AbstractScenarioGridCommand command); CommandResult<ScenarioSimulationViolation> undo(ScenarioSimulationContext scenarioSimulationContext); CommandResult<ScenarioSimulationViolation> redo(ScenarioSimulationContext scenarioSimulationContext);  }
@Test public void setUndoRedoButtonStatus() { scenarioCommandRegistryManagerSpy.setUndoRedoButtonStatus(scenarioSimulationContextLocal); verify(scenarioSimulationEditorPresenterMock, times(1)).setUndoButtonEnabledStatus(eq(false)); verify(scenarioSimulationEditorPresenterMock, times(1)).setRedoButtonEnabledStatus(eq(false)); reset(scenarioSimulationEditorPresenterMock); doneCommandsRegistrySpy.register(appendRowCommandMock); scenarioCommandRegistryManagerSpy.setUndoRedoButtonStatus(scenarioSimulationContextLocal); verify(scenarioSimulationEditorPresenterMock, times(1)).setUndoButtonEnabledStatus(eq(true)); verify(scenarioSimulationEditorPresenterMock, times(1)).setRedoButtonEnabledStatus(eq(false)); reset(scenarioSimulationEditorPresenterMock); undoneCommandsRegistrySpy.register(appendRowCommandMock); scenarioCommandRegistryManagerSpy.setUndoRedoButtonStatus(scenarioSimulationContextLocal); verify(scenarioSimulationEditorPresenterMock, times(1)).setUndoButtonEnabledStatus(eq(true)); verify(scenarioSimulationEditorPresenterMock, times(1)).setRedoButtonEnabledStatus(eq(true)); }