-
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 #41 from cathrkri/unitTesting
Unit testing and others
- Loading branch information
Showing
45 changed files
with
1,177 additions
and
721 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| push: | ||
| branches: main | ||
| pull_request: | ||
| branches: main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribition: temurin | ||
| java-version: "25" | ||
| cache: maven | ||
| - run: | ||
| mvn -B test |
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,2 @@ | ||
| .idea/ | ||
| target/ |
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,6 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <module version="4"> | ||
| <component name="CheckStyle-IDEA-Module" serialisationVersion="2"> | ||
| <option name="activeLocationsIds" /> | ||
| </component> | ||
| </module> |
8 changes: 4 additions & 4 deletions
8
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/Main.java
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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package ntnu.sytemutvikling.team6; | ||
|
|
||
| public class Main { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello world!"); | ||
| } | ||
| } | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello world!"); | ||
| } | ||
| } |
175 changes: 86 additions & 89 deletions
175
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java
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 |
|---|---|---|
| @@ -1,98 +1,95 @@ | ||
| /** | ||
| * This class represents a charity organization. It contains information about the charity such as its name, description, total donations, verification status, and category. | ||
| * | ||
| * This class represents a charity organization. It contains information about the charity such as | ||
| * its name, description, total donations, verification status, and category. | ||
| * | ||
| * @author Adrian Balunan | ||
| */ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
| import java.util.ArrayList; | ||
|
|
||
| abstract class Charity { | ||
| /* UUID for uniquely identifying each charity */ | ||
| private UUID id; | ||
|
|
||
| /* Name of the charity */ | ||
| private String name; | ||
|
|
||
| /* Description of the charity's mission and activities */ | ||
| private String description; | ||
|
|
||
| /* Total Donations received */ | ||
| private int totalDonations; | ||
|
|
||
| /* Is the charity verified? */ | ||
| private boolean isVerified; | ||
|
|
||
| /* Category for the charity */ | ||
| private String category; | ||
|
|
||
| /* List that contains the charity's Feedbacks */ | ||
| private List<Feedback> feedbacks; | ||
|
|
||
| /** | ||
| * Konstructor for creating a new charity. | ||
| * The ID is generated automatically using UUID. | ||
| * Total donations are initialized to 0. | ||
| * The charity is unverified by default. | ||
| * | ||
| * @param name | ||
| * @param description | ||
| * @param category | ||
| */ | ||
| public Charity(String name, String description, String category) { | ||
| this.id = UUID.randomUUID(); | ||
| this.name = name; | ||
| this.description = description; | ||
| this.totalDonations = 0; | ||
| this.isVerified = false; | ||
| this.feedbacks = new ArrayList<>(); | ||
| this.category = category; | ||
| } | ||
|
|
||
| /** | ||
| * Getters for the charity's attributes. | ||
| */ | ||
| public UUID getId() { | ||
| return id; | ||
| } | ||
| public String getCategory() { | ||
| return category; | ||
| } | ||
| public String getName() { | ||
| return name; | ||
| } | ||
| public String getDescription() { | ||
| return description; | ||
| } | ||
| public int getTotalDonations() { | ||
| return totalDonations; | ||
| } | ||
| public boolean isVerified() { | ||
| return isVerified; | ||
| } | ||
|
|
||
| /** | ||
| * Setter for verification status. | ||
| * This one sets the charity as verified. | ||
| */ | ||
| public void setVerified() { | ||
| this.isVerified = true; | ||
| } | ||
|
|
||
| /** | ||
| * Setter for verification status. | ||
| * This one sets the charity as unverified. | ||
| */ | ||
| public void setUnverified() { | ||
| this.isVerified = false; | ||
| } | ||
|
|
||
| /** | ||
| * Setter for total donations. This method is used to update the total donations when a new donation is made. | ||
| */ | ||
| public void setTotalDonations(int amount) { | ||
| this.totalDonations += amount; | ||
| } | ||
| public class Charity { | ||
| /* UUID for uniquely identifying each charity */ | ||
| private UUID id; | ||
|
|
||
| /* Name of the charity */ | ||
| private String name; | ||
|
|
||
| /* Description of the charity's mission and activities */ | ||
| private String description; | ||
|
|
||
| /* Total Donations received */ | ||
| private int totalDonations; | ||
|
|
||
| /* Is the charity verified? */ | ||
| private boolean isVerified; | ||
|
|
||
| /* Category for the charity */ | ||
| private String category; | ||
|
|
||
| /* List that contains the charity's Feedbacks */ | ||
| private List<Feedback> feedbacks; | ||
|
|
||
| /** | ||
| * Konstructor for creating a new charity. The ID is generated automatically using UUID. Total | ||
| * donations are initialized to 0. The charity is unverified by default. | ||
| * | ||
| * @param name | ||
| * @param description | ||
| * @param category | ||
| */ | ||
| public Charity(String name, String description, String category) { | ||
| this.id = UUID.randomUUID(); | ||
| this.name = name; | ||
| this.description = description; | ||
| this.totalDonations = 0; | ||
| this.isVerified = false; | ||
| this.feedbacks = new ArrayList<>(); | ||
| this.category = category; | ||
| } | ||
|
|
||
| /** Getters for the charity's attributes. */ | ||
| public UUID getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getCategory() { | ||
| return category; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public int getTotalDonations() { | ||
| return totalDonations; | ||
| } | ||
|
|
||
| public boolean isVerified() { | ||
| return isVerified; | ||
| } | ||
|
|
||
| /** Setter for verification status. This one sets the charity as verified. */ | ||
| public void setVerified() { | ||
| this.isVerified = true; | ||
| } | ||
|
|
||
| /** Setter for verification status. This one sets the charity as unverified. */ | ||
| public void setUnverified() { | ||
| this.isVerified = false; | ||
| } | ||
|
|
||
| /** | ||
| * Setter for total donations. This method is used to update the total donations when a new | ||
| * donation is made. | ||
| */ | ||
| public void setTotalDonations(int amount) { | ||
| this.totalDonations += amount; | ||
| } | ||
| } |
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.