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