|
@ -33,23 +33,22 @@ public class TestEmojiPicker { |
|
|
assertEquals(12, components.length); // 12 buttons for 12 emojis |
|
|
assertEquals(12, components.length); // 12 buttons for 12 emojis |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Test to check if each emoji button contains valid emoji text |
|
|
@Test |
|
|
@Test |
|
|
public void testEmojiPickerButtonText() { |
|
|
public void testEmojiPickerButtonText() { |
|
|
|
|
|
// Arrange |
|
|
|
|
|
JTextField textField = new JTextField(); |
|
|
|
|
|
EmojiPicker emojiPicker = new EmojiPicker(textField); |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
Component[] components = emojiPicker.getComponents(); |
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
assertTrue(button.getText().matches("[\uD83C-\uDBFF\uDC00-\uDFFF]+")); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 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 |
|
|
@Test |
|
|