From ea503cdf962649f9d1d6fd65dd218c8113525346 Mon Sep 17 00:00:00 2001 From: Paul Kattenborn Date: Fri, 9 Feb 2024 02:45:40 +0100 Subject: [PATCH] test_Farbtest1 + Hilfklasse --- src/test/java/ChatGUITest.java | 22 ++++++++++++++++++++++ src/test/java/TestActionEvent.java | 10 ++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/test/java/ChatGUITest.java create mode 100644 src/test/java/TestActionEvent.java diff --git a/src/test/java/ChatGUITest.java b/src/test/java/ChatGUITest.java new file mode 100644 index 0000000..ab84b47 --- /dev/null +++ b/src/test/java/ChatGUITest.java @@ -0,0 +1,22 @@ +import static org.junit.Assert.assertEquals; + +import java.awt.Color; + +import org.junit.Before; +import org.junit.Test; + +public class ChatGUITest { + + private ChatGUI chatGUI; + + @Before + public void setUp() { + chatGUI = new ChatGUI(); + } + @Test + public void testSetOutputTextColorRed() { + chatGUI.actionPerformed(new TestActionEvent(chatGUI.red)); + assertEquals(Color.RED, chatGUI.outputTextArea.getForeground()); + } +} + diff --git a/src/test/java/TestActionEvent.java b/src/test/java/TestActionEvent.java new file mode 100644 index 0000000..1a60355 --- /dev/null +++ b/src/test/java/TestActionEvent.java @@ -0,0 +1,10 @@ +import java.awt.event.ActionEvent; + +public class TestActionEvent extends ActionEvent { + + private static final long serialVersionUID = 1L; + + public TestActionEvent(Object source) { + super(source, ActionEvent.ACTION_PERFORMED, "Test command"); + } +} \ No newline at end of file