Browse Source

refactoring:testEmojiPickerActionListener

remotes/origin/client-handler
Valentin Spiroski 11 months ago
parent
commit
4e4755aba5
  1. 8
      src/test/java/TestEmojiPicker.java

8
src/test/java/TestEmojiPicker.java

@ -51,21 +51,21 @@ public class TestEmojiPicker {
}
}
// Test to ensure each emoji button has an EmojiActionListener attached
@Test
public void testEmojiPickerActionListener() {
// Arrange
JTextField textField = new JTextField();
EmojiPicker emojiPicker = new EmojiPicker(textField);
// Act
Component[] components = emojiPicker.getComponents();
// Assert
for (Component component : components) {
assertTrue(component instanceof JButton);
JButton button = (JButton) component;
assertNotNull(button.getActionListeners());
assertEquals(1, button.getActionListeners().length);
assertTrue(button.getActionListeners()[0] instanceof EmojiPicker.EmojiActionListener);
}

Loading…
Cancel
Save