From 0e2453a1ce083657352fd743ebc698c594f17544 Mon Sep 17 00:00:00 2001 From: Richard Schmidt Date: Fri, 9 Feb 2024 14:50:22 +0100 Subject: [PATCH] test_Check initial state of the login GUI and added setUp() method to initiate GUI before tests are run --- src/test/java/LoginGUITest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/java/LoginGUITest.java b/src/test/java/LoginGUITest.java index ca931d2..c3e76af 100644 --- a/src/test/java/LoginGUITest.java +++ b/src/test/java/LoginGUITest.java @@ -1,8 +1,25 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import java.awt.event.ActionEvent; +import org.junit.jupiter.api.BeforeEach; class LoginGUITest { + + private LoginGUI loginGUI; + + @BeforeEach + public void setUp() { + loginGUI = new LoginGUI(); + } + + @Test + public void testInitialState() { + assertNotNull(loginGUI.getUsernameField()); + assertNotNull(loginGUI.getPasswordField()); + assertNotNull(loginGUI.getLoginButton()); + assertNotNull(loginGUI.getStayLoggedInCheckbox()); + assertNotNull(loginGUI.getSignUpButton()); + } @Test public void testActionPerformed_LoginButton() { @@ -17,5 +34,7 @@ class LoginGUITest { // Verify if login was successful assertFalse(loginGUI.isVisible()); } + + }