assertTrue("keyStrokes are shared properly", keyStroke1 == keyStroke2);
}
public void testGetKeyStrokeForEvent() {
JComponent source = new JPanel();
KeyEvent event = new KeyEvent(source, KeyEvent.KEY_PRESSED, 0,
InputEvent.SHIFT_DOWN_MASK, KeyEvent.VK_B, 'B');
KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(event);
assertEquals("keyChar's correct", KeyEvent.CHAR_UNDEFINED, keyStroke.getKeyChar());
assertEquals("keyCode's correct", KeyEvent.VK_B, keyStroke.getKeyCode());
assertTrue("modifiers are correct", (InputEvent.SHIFT_DOWN_MASK & keyStroke
.getModifiers()) != 0);
assertFalse("onKeyRelease is correct", keyStroke.isOnKeyRelease());
event = new KeyEvent(source, KeyEvent.KEY_RELEASED, 0, InputEvent.SHIFT_DOWN_MASK,
KeyEvent.VK_C, 'C');
keyStroke = KeyStroke.getKeyStrokeForEvent(event);
assertEquals("keyChar's correct", KeyEvent.CHAR_UNDEFINED, keyStroke.getKeyChar());
assertEquals("keyCode's correct", KeyEvent.VK_C, keyStroke.getKeyCode());
assertTrue("modifiers are correct", (InputEvent.SHIFT_DOWN_MASK & keyStroke
.getModifiers()) != 0);
assertTrue("onKeyRelease is correct", keyStroke.isOnKeyRelease());
event = new KeyEvent(source, KeyEvent.KEY_TYPED, 0, InputEvent.SHIFT_DOWN_MASK,
KeyEvent.VK_UNDEFINED, 'T');
keyStroke = KeyStroke.getKeyStrokeForEvent(event);
assertEquals("keyChar's correct", 'T', keyStroke.getKeyChar());
assertEquals("keyCode's correct", KeyEvent.VK_UNDEFINED, keyStroke.getKeyCode());
assertTrue("modifiers are correct", (InputEvent.SHIFT_DOWN_MASK & keyStroke