|
|
@ -71,12 +71,12 @@ public class TestEmojiPicker { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//Test to verify the functionality of EmojiActionListener for each emoji button |
|
|
|
//Test to verify the functionality of EmojiActionListener for each emoji button |
|
|
|
@Test |
|
|
|
public void testEmojiPickerActionListenerFunctionality() { |
|
|
|
// Arrange |
|
|
|
JTextField textField = new JTextField(); |
|
|
|
EmojiPicker emojiPicker = new EmojiPicker(textField); |
|
|
|
JTextField textField = new JTextField(); // Initialize JTextField |
|
|
|
EmojiPicker emojiPicker = new EmojiPicker(textField); // Pass the initialized JTextField to the EmojiPicker constructor |
|
|
|
Component[] components = emojiPicker.getComponents(); |
|
|
|
|
|
|
|
// Act & Assert |
|
|
@ -86,8 +86,8 @@ public class TestEmojiPicker { |
|
|
|
EmojiPicker.EmojiActionListener actionListener = (EmojiPicker.EmojiActionListener) button.getActionListeners()[0]; |
|
|
|
assertNotNull(actionListener); |
|
|
|
actionListener.actionPerformed(null); |
|
|
|
assertEquals(button.getText(), textField.getText()); // Check if emoji is appended to the text field |
|
|
|
String expectedText = textField.getText() + button.getText(); // Expected text after appending emoji |
|
|
|
assertEquals(expectedText, textField.getText(), "Failed for emoji: " + button.getText()); // Check if emoji is appended to the text field |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|