Browse Source

test_Inputfield-Test

remotes/origin/server
Paul Kattenborn 11 months ago
parent
commit
a73279496a
  1. 14
      src/test/java/ChatGUITest.java

14
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());
}
}
Loading…
Cancel
Save