diff --git a/src/test/java/TestEmojiPicker.java b/src/test/java/TestEmojiPicker.java index 8179e87..cf7905e 100644 --- a/src/test/java/TestEmojiPicker.java +++ b/src/test/java/TestEmojiPicker.java @@ -33,23 +33,22 @@ public class TestEmojiPicker { assertEquals(12, components.length); // 12 buttons for 12 emojis } - + //Test to check if each emoji button contains valid emoji text @Test public void testEmojiPickerButtonText() { - - - JTextField textField = new JTextField(); - - EmojiPicker emojiPicker = new EmojiPicker(textField); - - Component[] components = emojiPicker.getComponents(); - - for (Component component : components) { - assertTrue(component instanceof JButton); + // Arrange + JTextField textField = new JTextField(); + EmojiPicker emojiPicker = new EmojiPicker(textField); - JButton button = (JButton) component; - assertTrue(button.getText().matches("[\uD83C-\uDBFF\uDC00-\uDFFF]+")); - } + // Act + Component[] components = emojiPicker.getComponents(); + + // Assert + for (Component component : components) { + assertTrue(component instanceof JButton); + JButton button = (JButton) component; + assertTrue(button.getText().matches("[\uD83C-\uDBFF\uDC00-\uDFFF]+")); // Check if button text is an emoji + } } @Test