public void respondToMatchingKeyEvent() {
final KeyEvent keyEvent = new KeyEvent(new JPanel(), KeyEvent.KEY_PRESSED, 0, KeyEvent.CTRL_DOWN_MASK, KeyEvent.VK_TAB, KeyEvent.CHAR_UNDEFINED);
keyboardShortcut.addAction(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
keyEvent.consume();
}
});
keyboardShortcut.processKeyEvent(KeyStroke.getKeyStrokeForEvent(keyEvent));
assertTrue(keyEvent.isConsumed());
}