-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from Group-5/fix/testcoverage
Merge Fix/testcoverage into release/v2.0.0
- Loading branch information
Showing
10 changed files
with
285 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package edu.group5.app.model; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import java.math.BigDecimal; | ||
|
|
||
| import org.junit.jupiter.api.Assertions.*; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import edu.group5.app.model.organization.Organization; | ||
| import edu.group5.app.model.user.Customer; | ||
| import edu.group5.app.model.user.User; | ||
|
|
||
| public class AppStateTest { | ||
| private User nullUser; | ||
| private BigDecimal nullDonationAmount; | ||
| private Organization nullOrganization; | ||
| private String nullPaymentMethod; | ||
|
|
||
| private User currentTestUser; | ||
| private BigDecimal currentTestDonationAmount; | ||
| private Organization currentTestOrganization; | ||
| private String currentTestPaymentMethod; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| nullUser = null; | ||
| nullDonationAmount = null; | ||
| nullOrganization = null; | ||
| nullPaymentMethod = null; | ||
|
|
||
| currentTestUser = new Customer(1, "Bob", | ||
| "Builder", "testuser@example.com", | ||
| "password123"); | ||
|
|
||
| currentTestDonationAmount = BigDecimal.ZERO; | ||
|
|
||
| currentTestOrganization = new Organization(1738, "TestOrg", | ||
| true, "https://testorg.example.com", true, | ||
| "A test organization", "https://testorg.example.com/logo.png"); | ||
|
|
||
| currentTestPaymentMethod = "Credit Card"; | ||
| } | ||
|
|
||
| @Test | ||
| void gettersAndSetters_WorkCorrectly() { | ||
| AppState appState = new AppState(); | ||
|
|
||
| // Test current user | ||
| assertEquals(nullUser, appState.getCurrentUser()); | ||
| appState.setCurrentUser(currentTestUser); | ||
| assertEquals(currentTestUser, appState.getCurrentUser()); | ||
|
|
||
| // Test current donation amount | ||
| assertEquals(nullDonationAmount, appState.getCurrentDonationAmount()); | ||
| appState.setCurrentDonationAmount(currentTestDonationAmount); | ||
| assertEquals(currentTestDonationAmount, appState.getCurrentDonationAmount()); | ||
|
|
||
| // Test current organization | ||
| assertEquals(nullOrganization, appState.getCurrentOrganization()); | ||
| appState.setCurrentOrganization(currentTestOrganization); | ||
| assertEquals(currentTestOrganization, appState.getCurrentOrganization()); | ||
|
|
||
| // Test current payment method | ||
| assertEquals(nullPaymentMethod, appState.getCurrentPaymentMethod()); | ||
| appState.setCurrentPaymentMethod(currentTestPaymentMethod); | ||
| assertEquals(currentTestPaymentMethod, appState.getCurrentPaymentMethod()); | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.