### Question:
AbstractCanvasShortcutsControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements CanvasControl.SessionAware<EditorSession>,
                   KeyboardControl.KeyShortcutCallback { @Override public void onKeyShortcut(final KeyboardEvent.Key... keys) { if (selectedNodeId() != null) { final Iterator<KeyboardShortcut> keyboardShortcutActionsIterator = keyboardShortcutActions.iterator(); while (keyboardShortcutActionsIterator.hasNext()) { final KeyboardShortcut action = keyboardShortcutActionsIterator.next(); if (action.matchesPressedKeys(keys) && action.matchesSelectedElement(selectedNodeElement())) { action.executeAction(canvasHandler, selectedNodeId()); } } } } @Inject  AbstractCanvasShortcutsControlImpl(final Instance<KeyboardShortcut> keyboardShortcutActions); @Override void register(Element element); @Override void bind(final EditorSession session); @Override void onKeyShortcut(final KeyboardEvent.Key... keys); String selectedNodeId(); Element selectedNodeElement();  }### Answer:
@Test public void testOnKeyShortcutNothingSelected() { mockSelectedElements(); mockActionReactingOnKeyAndSelectedElement(KeyboardEvent.Key.E, mock(Element.class)); canvasShortcutsControl.onKeyShortcut(KeyboardEvent.Key.E); verify(keyboardShortcutAction, never()).executeAction(any(), any()); }
@Test public void testOnKeyShortcutWrongPressedKey() { final Element selectedElement = mockSelectedElements("element").get(0); mockActionReactingOnKeyAndSelectedElement(KeyboardEvent.Key.T, selectedElement); canvasShortcutsControl.onKeyShortcut(KeyboardEvent.Key.E); verify(keyboardShortcutAction, never()).executeAction(any(), any()); }
@Test public void testOnKeyShortcutWrongElement() { mockSelectedElements("element"); mockActionReactingOnKeyAndSelectedElement(KeyboardEvent.Key.E, mock(Element.class)); canvasShortcutsControl.onKeyShortcut(KeyboardEvent.Key.E); verify(keyboardShortcutAction, never()).executeAction(any(), any()); }
@Test public void testOnKeyShortcutSelectedElements() { mockSelectedElements("element-1", "element-2"); mockActionReactingOnKeyAndSelectedElement(KeyboardEvent.Key.E, mock(Element.class)); canvasShortcutsControl.onKeyShortcut(KeyboardEvent.Key.E); verify(keyboardShortcutAction, never()).executeAction(any(), any()); }