diff --git a/src/test/java/ChatGUITest.java b/src/test/java/ChatGUITest.java index 04fa7d0..47cc055 100644 --- a/src/test/java/ChatGUITest.java +++ b/src/test/java/ChatGUITest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertEquals; import java.awt.Color; import java.awt.Font; +import java.awt.event.ActionEvent; import org.junit.Before; import org.junit.Test; @@ -61,6 +62,19 @@ public class ChatGUITest { String expectedOutput = "Testnachricht\n"; assertEquals(expectedOutput, chatGUI.outputTextArea.getText()); } + @Test + public void testInputTextFieldActionPerformed() { + + chatGUI.inputTextField.setText("Testnachricht"); + chatGUI.actionPerformed(new ActionEvent(chatGUI.inputTextField, ActionEvent.ACTION_PERFORMED, "")); + + + String expectedOutput = "Testnachricht\n"; + assertEquals(expectedOutput, chatGUI.outputTextArea.getText()); + + + assertEquals("", chatGUI.inputTextField.getText()); + } }