diff --git a/src/test/java/TestEmojiPicker.java b/src/test/java/TestEmojiPicker.java index cf7905e..4843226 100644 --- a/src/test/java/TestEmojiPicker.java +++ b/src/test/java/TestEmojiPicker.java @@ -51,24 +51,24 @@ 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); - JTextField textField = new JTextField(); - - EmojiPicker emojiPicker = new EmojiPicker(textField); - - Component[] components = emojiPicker.getComponents(); - - 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); - } + // 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); + } } @Test