### Question:
ApplicationCommandManager implements SessionCommandManager<AbstractCanvasHandler> { void onSessionDestroyed(@Observes SessionDestroyedEvent event) { final String sessionUUID = event.getSessionUUID(); final RegistryAwareCommandManager commandManager = getCommandManagers().get(sessionUUID); commandManagerInstances.destroy(commandManager); getCommandManagers().remove(sessionUUID); } @Inject  ApplicationCommandManager(final SessionManager sessionManager,
                                     final MouseRequestLifecycle lifecycle,
                                     final @Any ManagedInstance<RegistryAwareCommandManager> commandManagerInstances); @PostConstruct void init(); @Override void start(); @Override void rollback(); @Override void complete(); CommandResult<CanvasViolation> allow(final Command<AbstractCanvasHandler, CanvasViolation> command); CommandResult<CanvasViolation> execute(final Command<AbstractCanvasHandler, CanvasViolation> command); 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 CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); @PreDestroy void destroy();  }### Answer:
@Test public void testOnSessionDestroyed() { tested.start(); tested.onSessionDestroyed(new SessionDestroyedEvent(SESSION_ID, "diagram1", "graph1", mock(Metadata.class))); assertTrue(tested.getCommandManagers().isEmpty()); verify(commandManagerInstances, times(1)).destroy(eq(commandManager)); }