|
|
@ -33,22 +33,21 @@ 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() { |
|
|
|
|
|
|
|
|
|
|
|
// 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; |
|
|
|
assertTrue(button.getText().matches("[\uD83C-\uDBFF\uDC00-\uDFFF]+")); |
|
|
|
assertTrue(button.getText().matches("[\uD83C-\uDBFF\uDC00-\uDFFF]+")); // Check if button text is an emoji |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|