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