From 0a4721e91e020cbbe9d534c410133f9d51b29457 Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Tue, 3 Mar 2026 16:49:27 +0100 Subject: [PATCH 01/25] Added getHashPassword to PasswordHasher --- .../helpmehelpapplication.iml | 6 +++ .../team6/models/PasswordHasher.java | 52 +++++++++++++++++++ .../sytemutvikling/team6/models/User.java | 6 +-- 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 helpmehelpapplication/helpmehelpapplication.iml create mode 100644 helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java diff --git a/helpmehelpapplication/helpmehelpapplication.iml b/helpmehelpapplication/helpmehelpapplication.iml new file mode 100644 index 0000000..9e3449c --- /dev/null +++ b/helpmehelpapplication/helpmehelpapplication.iml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java new file mode 100644 index 0000000..8c2c7ce --- /dev/null +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java @@ -0,0 +1,52 @@ +package ntnu.sytemutvikling.team6.models; + +import javax.crypto.SecretKeyFactory; +import javax.crypto.interfaces.PBEKey; +import javax.crypto.spec.PBEKeySpec; +import java.security.SecureRandom; +import java.util.Base64; + +/** + * A password hasher + * + *

+ * Description + *

+ * + * @author Robin Strand Prestmo + */ +public final class PasswordHasher { + private static final SecureRandom RNG = new SecureRandom(); + + /** + * Get the hash of the password + * + * @param password a string password + * @return a hash secured password + */ + public String getHashPassword(String password) { + String hasPass = ""; + + try { + // 1. Create salt + byte[] salt = new byte[16]; + RNG.nextBytes(salt); + + // 2. Create PBKDF2 Hash value + PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 100000, 32*8); + SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); + byte[] hash = factory.generateSecret(spec).getEncoded(); + + // 3. Combine salt and password bytes + byte[] hashBytes = new byte[48]; + System.arraycopy(salt, 0, hashBytes, 0, 16); + System.arraycopy(hash, 0, hashBytes, 16, 32); + + //4. Turn the combined salt+hash into a string. + hasPass = Base64.getEncoder().encodeToString(hashBytes); + } catch (Exception e) { + throw new RuntimeException("Error while hasing password.", e); + } + return hasPass; + } +} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java index 283bfa1..afa414a 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java @@ -2,9 +2,9 @@ import java.util.UUID; -// Passord må hashes!!! -// Unntakshåndtering mangler -// Enhetstesting mangler +// TODO: Passord må hashes!!! +// TODO: Unntakshåndtering mangler +// TODO: Enhetstesting mangler /** * Represents a user. From eed6f98d875d54cc53ba2eaf8c923f503b08efb8 Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Tue, 3 Mar 2026 17:44:57 +0100 Subject: [PATCH 02/25] Added isValidPassword to PasswordHasher --- .../team6/models/PasswordHasher.java | 73 +++++++++++++++---- 1 file changed, 57 insertions(+), 16 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java index 8c2c7ce..72d3562 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java @@ -1,17 +1,17 @@ package ntnu.sytemutvikling.team6.models; -import javax.crypto.SecretKeyFactory; -import javax.crypto.interfaces.PBEKey; -import javax.crypto.spec.PBEKeySpec; +import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Base64; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.PBEKeySpec; /** - * A password hasher + * A utility for hashing and verifying passwords using PBKDF2. * - *

- * Description - *

+ *

The generated hash contains both a random salt and the hashed password, + * encoded as Base64 string. + *

* * @author Robin Strand Prestmo */ @@ -19,13 +19,18 @@ public final class PasswordHasher { private static final SecureRandom RNG = new SecureRandom(); /** - * Get the hash of the password + * Hashes a password using PBKDF2 and a random salt. * - * @param password a string password - * @return a hash secured password + * @param password the password to hash. + * @return a Base64 string containing the salt and the hashed password. + * @throws IllegalArgumentException if the password is null or blank. */ public String getHashPassword(String password) { - String hasPass = ""; + if (password == null || password.isBlank()) { + throw new IllegalArgumentException("Password cannot be null or blank."); + } + + String hashPass = ""; try { // 1. Create salt @@ -33,7 +38,7 @@ public String getHashPassword(String password) { RNG.nextBytes(salt); // 2. Create PBKDF2 Hash value - PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 100000, 32*8); + PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 100000, 32 * 8); SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); byte[] hash = factory.generateSecret(spec).getEncoded(); @@ -42,11 +47,47 @@ public String getHashPassword(String password) { System.arraycopy(salt, 0, hashBytes, 0, 16); System.arraycopy(hash, 0, hashBytes, 16, 32); - //4. Turn the combined salt+hash into a string. - hasPass = Base64.getEncoder().encodeToString(hashBytes); + // 4. Turn the combined salt+hash into a string. + hashPass = Base64.getEncoder().encodeToString(hashBytes); + } catch (Exception e) { + throw new RuntimeException("Error while hashing password.", e); + } + return hashPass; + } + + /** + * Checks if the password matches a perviously stored hash. + * + * @param password The password the user types. + * @param hashPass Is the stored hashed password + * @return True if password is valid, otherwise false. + */ + public boolean isValidPassword(String password, String hashPass) { + if (password == null || password.isBlank()) { + return false; + } + + try { + // Extract the bytes + byte[] hashBytes = Base64.getDecoder().decode(hashPass); + + // Get salt + byte[] salt = new byte[16]; + System.arraycopy(hashBytes, 0, salt, 0, 16); + + // Compute the hash on the password the user entered + PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 100000, 32 * 8); + SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); + byte[] hash = factory.generateSecret(spec).getEncoded(); + + // Compare results + byte[] storedHash = new byte[32]; + System.arraycopy(hashBytes, 16, storedHash, 0, 32); + + return MessageDigest.isEqual(storedHash, hash); + } catch (Exception e) { - throw new RuntimeException("Error while hasing password.", e); + throw new RuntimeException("Error while validating password.", e); } - return hasPass; } } From 9b9d8eafa856c2419190fa97f8409ef539a9232c Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Tue, 3 Mar 2026 17:55:13 +0100 Subject: [PATCH 03/25] Added password hashing to User --- .../ntnu/sytemutvikling/team6/models/User.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java index afa414a..a6a87ad 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java @@ -2,7 +2,6 @@ import java.util.UUID; -// TODO: Passord må hashes!!! // TODO: Unntakshåndtering mangler // TODO: Enhetstesting mangler @@ -12,10 +11,12 @@ * @author Robin Strand Prestmo */ public class User { + private static final PasswordHasher passwordHasher = new PasswordHasher(); + private final UUID id; private String name; private String email; - private String password; + private String passwordHash; private final String role; private final Settings settings; private final Inbox inbox; @@ -43,7 +44,7 @@ public User(UUID id, this.id = id; this.name = name; this.email = email; - this.password = password; + this.passwordHash = passwordHasher.getHashPassword(password); this.role = role; this.settings = settings; this.inbox = inbox; @@ -77,16 +78,21 @@ public Inbox getInbox() { // Add Setters - public void setName(String name) { this.name = name; } public void setPassword(String password) { - this.password = password; + this.passwordHash = passwordHasher.getHashPassword(password); } public void setEmail(String email) { this.email = email; } -} + + // Other methods + + public boolean checkPassword(String password) { + return passwordHasher.isValidPassword(password, passwordHash); + } +} \ No newline at end of file From ab2de3dd6ec22523a78efad5ffc8da1ddd17fa90 Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Tue, 3 Mar 2026 18:44:40 +0100 Subject: [PATCH 04/25] Added Junit tests to PasswordHasher --- .../sytemutvikling/team6/models/Donation.java | 2 + .../sytemutvikling/team6/models/Feedback.java | 2 + .../team6/models/{ => user}/Inbox.java | 2 +- .../team6/models/{ => user}/Language.java | 2 +- .../team6/models/{ => user}/Message.java | 2 +- .../team6/models/{ => user}/Role.java | 2 +- .../team6/models/{ => user}/Settings.java | 2 +- .../team6/models/{ => user}/User.java | 4 +- .../{models => security}/PasswordHasher.java | 2 +- .../team6/security/PasswordHasherTest.java | 70 ++++++++++++++++++ .../ntnu/sytemutvikling/team6/Main.class | Bin 0 -> 568 bytes .../sytemutvikling/team6/models/Charity.class | Bin 1676 -> 1676 bytes .../team6/models/CharityRegistry.class | Bin 2899 -> 2943 bytes .../team6/models/Donation.class | Bin 1787 -> 1813 bytes .../team6/models/DonationRegistry.class | Bin 2924 -> 2970 bytes .../team6/models/Feedback.class | Bin 1537 -> 1563 bytes .../sytemutvikling/team6/models/Inbox.class | Bin 2879 -> 0 bytes .../team6/models/Language.class | Bin 1040 -> 0 bytes .../sytemutvikling/team6/models/Message.class | Bin 1549 -> 0 bytes .../sytemutvikling/team6/models/Role.class | Bin 1075 -> 0 bytes .../team6/models/Settings.class | Bin 1589 -> 0 bytes .../sytemutvikling/team6/models/User.class | Bin 1787 -> 0 bytes .../team6/models/UserRegistry.class | Bin 327 -> 327 bytes .../team6/models/user/Inbox.class | Bin 0 -> 2973 bytes .../team6/models/user/Language.class | Bin 0 -> 1146 bytes .../team6/models/user/Message.class | Bin 0 -> 1559 bytes .../team6/models/user/Role.class | Bin 0 -> 1181 bytes .../team6/models/user/Settings.class | Bin 0 -> 1624 bytes .../team6/models/user/User.class | Bin 0 -> 2320 bytes .../team6/security/PasswordHasher.class | Bin 0 -> 2772 bytes ...sswordHasherTest$getHashPasswordTest.class | Bin 0 -> 2725 bytes ...sswordHasherTest$isValidPasswordTest.class | Bin 0 -> 3211 bytes .../team6/security/PasswordHasherTest.class | Bin 0 -> 772 bytes 33 files changed, 83 insertions(+), 7 deletions(-) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/{ => user}/Inbox.java (97%) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/{ => user}/Language.java (70%) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/{ => user}/Message.java (97%) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/{ => user}/Role.java (70%) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/{ => user}/Settings.java (97%) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/{ => user}/User.java (94%) rename helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/{models => security}/PasswordHasher.java (98%) create mode 100644 helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Language.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Message.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Role.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Inbox.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Language.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Message.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Role.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Settings.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class create mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/security/PasswordHasher.class create mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest$getHashPasswordTest.class create mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest$isValidPasswordTest.class create mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest.class diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java index 16e44cb..c72fbee 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java @@ -1,5 +1,7 @@ package ntnu.sytemutvikling.team6.models; +import ntnu.sytemutvikling.team6.models.user.User; + import java.time.LocalDateTime; import java.util.UUID; diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java index 2a0657e..4825c95 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java @@ -1,5 +1,7 @@ package ntnu.sytemutvikling.team6.models; +import ntnu.sytemutvikling.team6.models.user.User; + import java.time.LocalDateTime; import java.util.UUID; diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Inbox.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java similarity index 97% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Inbox.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java index 00c8f52..2aa0605 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Inbox.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.models.user; import java.util.*; diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Language.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java similarity index 70% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Language.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java index d4ab0ae..0afb14c 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Language.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.models.user; /** * Supported application languages. diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Message.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java similarity index 97% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Message.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java index 10ea569..eba920f 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Message.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.models.user; import java.time.LocalDateTime; import java.util.UUID; diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Role.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Role.java similarity index 70% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Role.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Role.java index cde9117..74e134f 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Role.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Role.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.models.user; /** * Available users diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Settings.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java similarity index 97% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Settings.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java index cd70f0a..6bbc685 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Settings.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.models.user; // Mangler Enhetstesting diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java similarity index 94% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java index a6a87ad..654fff6 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/User.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java @@ -1,4 +1,6 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.models.user; + +import ntnu.sytemutvikling.team6.security.PasswordHasher; import java.util.UUID; diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java similarity index 98% rename from helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java rename to helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java index 72d3562..60b2876 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PasswordHasher.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.sytemutvikling.team6.security; import java.security.MessageDigest; import java.security.SecureRandom; diff --git a/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java b/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java new file mode 100644 index 0000000..68a9409 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java @@ -0,0 +1,70 @@ +package ntnu.sytemutvikling.team6.security; + +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class PasswordHasherTest { + private final PasswordHasher hasher = new PasswordHasher(); + + @Nested + class getHashPasswordTest { + + @Test + void shouldThrowIfPasswordIsNull() { + assertThrows(IllegalArgumentException.class, () -> hasher.getHashPassword(null)); + } + + @Test + void shouldThrowIfPasswordIsBlank() { + assertThrows(IllegalArgumentException.class, () -> hasher.getHashPassword(" ")); + } + + @Test + void shouldReturnDifferentHashesForSamePasswordBecauseSaltIsRandom() { + String test1 = hasher.getHashPassword("Password"); + String test2 = hasher.getHashPassword("Password"); + + assertNotEquals(test1, test2); + } + } + + @Nested + class isValidPasswordTest { + + @Test + void shouldReturnTrueForCorrectPassword() { + String test = hasher.getHashPassword("Password"); + assertTrue(hasher.isValidPassword("Password", test)); + } + + @Test + void shouldReturnFalseForWrongPassword() { + String test = hasher.getHashPassword("Password"); + assertFalse(hasher.isValidPassword("password", test)); + } + + @Test + void shouldReturnFalseIfPasswordIsBlank() { + String test = hasher.getHashPassword("Test"); + assertFalse(hasher.isValidPassword(" ", test)); + } + + @Test + void shouldReturnFalseIfPasswordIsNull() { + String test = hasher.getHashPassword("Test"); + assertFalse(hasher.isValidPassword(null, test)); + } + + @Test + void shouldThrowIfStoredHashIsNull() { + assertThrows(RuntimeException.class, () -> hasher.isValidPassword("Password", null)); + } + + @Test + void shouldThrowIfStoredHashIsBlank() { + assertThrows(RuntimeException.class, () -> hasher.isValidPassword("Password", " ")); + } + } +} \ No newline at end of file diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..110f8b9c4ad1592f72a4edc10270d108662df524 GIT binary patch literal 568 zcmaKqO;5r=5Qg97tF%@@5d22)1Rm^74;U{-Z03Duo}KLUwg{v5`fNp*Z3b?noXCovYr+>nn!bkqCr3 zW=J<%T@!hj1}qy3u>X{Ireo##R29b5RB;oK2%YOl1gfJVkNfRBmKf}FPs*_V7)El? zuu#OZfs&0fRv5~2x)_WH&5!|Mn=@`QAVEbiY`3}wstmP21+g=p(h#wlh##nRGwoqSe-DA`ret)gP3~Ief_#erR-vL+L|Ta;IHqHmQm2xRf-CpZ zg~J2!7x)M4P*D)viCg#LA5pw-C@7fCJ@?&v-#O>r1NXqa_wDz`&j7Ar&4C8phQVRN zVkqqd&jWuqhzI`dM>}CZVX!Vnag-2V)qw;cyhd8H)M%vn1N}H#e_emG4-y zP{f3d62~N_Qn!#x@rmxEl^_t_D$7u#9+TRL?(c>uGW?=VioRPm+)m?zDrWQHQp_P7_E322_ z=qTo~evpKNz2S@W=Z1EnC2z2%e8B4OJ*~-J7U>v(O_9t~rYX-klB*oaMUJGOBXQ

24Pnmfr$^WGq|FYVOn?@DnidtQ=uUyK4GDEgl2}bVktvg z{?OOYD+f&dR+q{Bb=4-s$*=-`tl<-?DN`K6l|93oRLcKW+w#qb>a_emqFRw9^M8h# zyk#y{=CL|LvmsxZtr_dMvqCCoR{*!sG7%#<>PgHg zm`D(^d+sZ@x$pY@=7ZfmuNxkHC<#Kscb|KN{MK1}I}D`X-yo!W-mn|U7oi;ZDn~PO z1WOLvULc=IuScNAgjClJz5XCLP?E~(J>5?yuS;KsHwf1p^_wdE<*(M-tkfFxJPUCY zZA_y?hmg$tN7F-w??47?2GesgE%?kyV^F@N-^vP-yR!$5KZghd-BQo5?xnD|>Q z+pv(9EKKZDC&EwHl~o(Rnx{KQXlKF3cY4Oyg1&P7UL?W zr6OdZ2w5gV7KxCbM##f>RxYaZY=-4=j?Wop-tp7~Sz4U743lZYaNyy=}N1{nO(>HsYa7g-!jB8%Bqv7=d|*_ zY(u>r!!D>FW7s8?HU6JaRric#{&5>)G*{Fc!zq+bJL~LIyGe=!=ThH{`k0oEtgPf( gQ9EsM9-S>MI>)HaKINULhsj1J&2tEw+==1lAF6t6vj6}9 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/CharityRegistry.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/CharityRegistry.class index 61b85038c64275096044f821b577e36bed01d1fc..c923756121ae7c43839e549f30a867c6dec35aa1 100644 GIT binary patch literal 2943 zcmb7GZC4vb7`+3OO_t@w@KOkZfV545C5VdFP!uTGXegDp3TkyoCShT-OEt6;b!Um8J(1i~5Mk)|2Dy%Iq?c`*S95yBQK6tciY{mhx;6Bm zmtoFyOgCMrI-=}4XZneu6Rab6c_Cf43c{$QSC6=@JJl^wA_%+65Y2l%x~PzrT%AW! zWK_I?n1X%{0~ll&tp8rM41>h#mMQ1CCc*1PogW%PPGp!$G-D;3I~3fcarN-CgjnLn zvR!h^!gSW2=f$Zch+u>v9th7CCi2{zFfC`|P)wMvVa%!+!l-ofO;Q-pdVX#@HpQPw z?sZ`tZz-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t3B%JoVR%`{a^#i` zoWWVPtEY6{Pro)THQx>jm%r_*s#%eqDvaO*e3-;Jfj7HCdT0!Mg!5EXGc8ZK0_Wot zuRx3!tOqFIDj2wci=13t`)j7FMIY{oF;?VsH2u0Y;^QB5hQMgqla;L-a=SfKBeL4* zCxNB;{%4CNN#TmXWK`9cYN{)C&A_L)&J97HJ(Ud?Rw1`8kcw0bEbc=ATftQgXGcX6 zxNqXA4yR!~%T=?i#oRJ*8()wv^eWZ_j>YX?RT{0%l8ue3oI5SB5;qUv_aQg8p2j^q zNP@dE*Y~D1@FgA!7~EfLn_P%qF!jC5D^QZgSNJB0uX_eW-x&B-mtaUe_NB$e7sazI zkS;sETT$0cy>us{G)8N4N%uF~=(6K@>`S?QLwTD{wV6g0wIt{g8-3H>akf;x6y%DA zvL-8@Q`rfMefgTRUI!tIH&H+M<21g2ka%B~0#jbl_l!0pK2Mg619XOiC%Nb$+t10CH6 zPcG9+@R?b724mp`#vVRH=64+UHLyO&&#?d}g+Y3a)9(<^jL-)YILvR{oOp}aA;V;V zdxobPH?{B^4*Y?sU-+JY#?xAW(HKsugEK?j5zcIY(;|C<_VbH>WAp`%Kg^zZhEsoO z)LkrazdXljU>ENv`0=rT<{1chrpN>wpzbVVI7E#Tn5EuReAh7?4sqMuWWWk8QQId0 zf*9lLD$^6DsnV7))se9l$ynUQ)dU{sgoVUeQUX)_JVN55nB;$iF5y&%a0*3y)=T&~ zN_z;WJA|FM8S)Js^34Q(?vRF6I!4l2lFr2lr#pnxdm_xFb$7Q3&oUi4(ZdUiPjUAt z)-`s#ViN&oSovZ06r~e@o!u`$C@KO7V;{ix0gc24pSmO_v-k)NIKkUCn(*NBPB-ih Jp5RAJ{tr(1?_K}^ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class index 28853eca2459be072730105ee9d9b4a9cda23bf8..e4b6592e62098fc717e5aa60c9cc09902f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ling/team6/models/Inbox.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class deleted file mode 100644 index 72613e7b9d3b93e13c31cabfb4cd0b77c2d6076c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2879 zcmb7FYf~Fl7=BKmY*>~{gT+EE(w5c)EP+aV0XehN@DtJ9fPQt=wm+l3@%Rll% zozWt6Mn5{^_?sNxv%4gllqv9KH~XIVJkRr9^Ur_Be*&1t&kAA;cTCsx($0Y^DxSNi z?-;sSPP>9v#?uw6C=4f^HS^ZKf@X%UZNA6T1}Bf@{I)2#4DpI^99|XnSc zTcn>J64+K2ZYY>8CX%U!c*$kz72}1HpyC>?D|n0HN-fe^%P^=Cx@9^V`tdf^!856H zddUw*=78a5vQf+_>N-ohSqvkXImi~NH=@_p*0OV%=(Xit$;u51?8&(tFBGhTLDF4o zxGaTP=Ek&L_A0`3=l2W3=a1tKLvJWMTO25G)3n@yycjS&!x&L<3rX1`Dau-?(r@4u z*QQR-q}JOojJpcnW$377Ri;hD2-4Jej%(96FkGvvUSLfV3>{_?G*M$3?%_VQrYmI5 zM_-$hl4trwOFy>;WZLjPK2R{u@McX&9gT(um>@+Z-Ef7?FcGCV1uS?x~A0QsLH0FpIJ+qJ!>t1w;Fa%L_Y8d^a2)l^0K1iQ(=!rYI~R z)gz8M(h+_)lvCDfLBl6lq&+|s4K)pxQYN*@poDrEhRz=06LN~f78Pqxga%qE(F_L@ zuo=fAhO42=D;<}hT{9+iey-sOR%k;8kl7N$jVRh_^&;VMgIDrJJ~+zoFzW7;pFfn; zri!Q7Q1AsUvGXok4V(Cq;Sy~!S?Bs4<_l2qHNI8wP2I4_6Ajw^B1P{2S)XpYiZ!0KUl0q9L5YoMr8JyP04iMpr?^Qg?CnU{^%l&wm(D zzW#1Fqfx!H+%Q&j+6bL35M5YQsijN}t5_ogEuss}(`FZTLk!wz+{bXp#-L?QQ`oZx zcO2m;IAFM4Teo#V)~8Ovj|}~^&;m+06yMAz@Q{HyQXP0tP=ryI?91D&`+Pe2Rq&{q$A(dNWe!VVaEecXFw zmALVt-*EX4^gXBFF-SbA1-Kr;iC1w3NcRcOO&_O1>@o6B4*!kzm$8mGBtL zGR(&@{8A+iBAg}CIU-$%5cXFI`x_$cQe{Jjg!d^OGP$io!!NM@0$)k&XqAGj1=Vg1 vq!R#j^LYURQFQ>6vAj=HK#|_EBs*j?VBwkn%Z7(Nd{1YxN%!#senRj6*qz`8 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Language.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Language.class deleted file mode 100644 index de22840e2faa5672993a34756d66b15239b7fbe3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1040 zcmb7CT~pIQ6g}INrVS~SqE#q?Ej#E@$wDV3TzQEi1jIjrw%?E>YN zRm>nKcDGc>$TQ5Fj%T-`LD%-*@vduAjyddcx6OS=oa3MZ33F66{Nw~wXvE#frp-o8 zo5qKN72KC`kD-*(Hx8&3Djwh=LxKA~ANPh|#teGe#ZmXf?uGUJl(Fj&Iis$`l8!zy z?4)6dd2Ncv7FJhPJi=3k7iq3Nmj^*TCE$j9Vn&Pz^;)rpk>9glJK{Nu*YmU?^2np* z^gSL%KHa@c(Fts03ZdKe-A(GFM6;dQT@q~tO3R|D6v@(BfS8V1I_=O|eAORdow6#O zqj-je>`yvLr&zGgu=tIxGq_EwLVpmrNEDSgDsE`P60%JyDT>Pa+R8cZOn^B`Kmt6e{`&~YeLFHl|oN;g+BuGrX(gaWnXal)Zfj;N)S WnSOyMzrg;D%ivke`5d+Qul)ru81$b2 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Message.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Message.class deleted file mode 100644 index 12c1cec780b114eaf18df46e8009a8bff591b4a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1549 zcma)5+fEZv6kUh5Oc@5j3L+p_Etg2r~Iqbn~V@{DriHDA(TkwWpv`UgsyXK1|=)##vQ8HtgKKY2mbw+ z5_%biP8Hd-ETgPj%U-!^Q&a2jipC)~T_=jW3XR6hzQ0ym18*qQcV@v;^Ly0vS;m5AaCBLxyfY&*f<9}th z`c5)kzPBL4&naky!qA>I9pgpSE*M@;F9aJVRwS=`ra0HZFn?oK7}V@__nTI$ZHMc{ zgDw5A9wSmV_$F<4l&n8KhR%~J&+oHDH^gX2J@V=kAc1}2nZ=fO+^SbJHcU~sQvb3t zLLLlKk0JUnBZvuY$%_ePeM`FfmQ?jE2|>1*7;U&g&vrWfA$FLot{$T!^$T+93vPWt z+jsQr#rlrX|1(Ws`V1Hs;5dQfXTTu=s$VfugQ})#NUP}@GU|8@6NFCHF#Cy;gfLIf zX-W?aP}(6XVVG8U6eAcz1}f%|!YX;spn$YBzDn8GXCiUne+L9tlGV>(gUezVN? zM7vGCCmIf6iTqwP|Dz;f2~0v~@CRCC`jG%nkgUs~krh!Q>Sw4Q$!YRS6Mt$tw-XnTzD5hUC?Ty?O diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Role.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Role.class deleted file mode 100644 index f19f0d329763812b4a709a4241f91f6d46660b20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1075 zcma)4U2hUm5IvU#mX9q(wA6n1-CEdINFQusAWaFuNL(Oc3kmVTTyU*hm&Gi*B>XF- z4{bCyKKrALbGMtqgC^|5-kCdd&YZb3zyEx{22evmMu=h8c5SaXp1Q`+b0_9!%e2pm zuEB>##o_3KVU3IJk!8pTGo;S>gcmJN2{qdrG9;U=cB7)b@94EQ!=APjRf$2VzNxh9 zr@a7}tTj80oo+?z)O3d2yQO(zK?KnlWZ`5L$cPH-zJeIyM5URw(e#FW!#U-B%V5Z8qXDI%rRA+aLY5uP;>cZ8%p3Yp2~Q_kX{fv9n)wOJi`t{oI4Jm4n|+5f_R~w zR{z`>xTX3(uBb%@*_YG$$WU5@1+S1_^2J4qIR(4OGrU~nsakwIE-e(lC7w4TR)%Ju z&_|v#FkYMD8RKHN3L=MW-8{3o>p67)YJp1N%1a77E}b0G+$7p>>10F96rhvF38Xj0 zFewtIGl3-KDdcs@7hmBASTD08T_SaXjPKkF`_5YACxxULGI}pO!2g-VT1lD zzgiqC#3?Fl`VkSO?F(ugQjX9htNYuR*qVc*lz;%F__mB~A(n(bz{3E3M2!e|c82xd zTS>j{m4%{)v~`6?2VW_2BjtvT-Aahlq@D*HD&>e;i40S(u=fk>|F{rTpK~7v{`ulB D2n_Uq diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class deleted file mode 100644 index 9420861a9951a8429b08d5a232a8ced6cafaf647..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1589 zcmb7ET~8B16g|^jy8VWh0xDmnKy9~$s-Q6ezd{g+1s`fiAn{>aH_O6ym$XxqpTaNj z#RoMK5>52c#2+Qz*|uyYO{8hEGjn_IIrp49yTAW@`vG7b_Z9dUayGY{#l{KOYfXM^ z9$Kbt6uGX|9u#ZNTit3D%R1*2Y$%W!h7Po2t!QbK^r~{8S2;t_GL3z{Mac|ok0Bub zZE6M`^QHfym)glI1fKm-cSOXf78oION9hO3cQY}D8*~yV$u`O<@yQfRtLL~`_=V_q zjPE8U&oTW|9Y3RR;S6)?)Nt!i(Yj7QTYzD2V{G|PR`=(Cm6<4mvPh`Zt~LFBncK*Lr9dsVzgaEu}vjbVcdZ5?IUe`?g;&E maIH(hKpT%fRk+)uc<$4c;*Flg_j)pCt}?&uS-j*@EdK@YgDD;W diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class deleted file mode 100644 index c0cc6c87cded03b76d2e92e8c97e2e1da84a487c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1787 zcmbVLZBNr+6g|(_)-kH!c#$FUDzcT0A}W|*@B@M&E@+s{L_c-VV6p2=+oAp`qlt}) zG5!F5l=0rD1+kQ{_@(#udG0yA_ny;VzrX(ku!#o>QUY_1?{swUqi?o4{;~Dewwy!V zH;vYc-fAD1wx{oTrmG+=FmPlX8@g>!!L#O(x$g_4tOGi)$%~F}+4|nz_Tx2yv}3eP zfkJpAA$8v+YP!pqEyJ<}a_zpD$jYQ?^BT{uu!|SuXl$O(Me-J2L zj@sr*f@B|Bj^(cld@9A;Ki~9!o^(G#w|$ozw5$!%C668qsTjbpKu@XM=!L*_6&YkX zE2>bC`)1p0Bq%?!LKY@mhO% zF^l};V4C*dL%*bg0t-l4ish4$#FLSvqgY_!WF*;SB+)45iD3ZO=vkn*AB5+siuMhI z+CqR4trB2Vs|Fa;is=C3S}_w~LMvtiOld_Wz|0q_PvI6lZG~t@dPQE@eDj)g$+o&obenPneik%Gk>X{=BB?G z@ZzRhJASVb!VX sS?N|*>RvL}c$}+2TrV%+VvjJ_{ba7OIM*xUdVK*GJCC_mq;*#R01lHzzW@LL diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class index 970aced91dfd7f8c243d76c46fae27be61d4a66b..ce901b4a918fd9f434bfdda2f2b2be33c2d60ef4 100644 GIT binary patch delta 89 zcmX@kbeu{2)W2Q(7#J8_83ec(m>8JZ8CZB2SQ*$RIw%3z920pB*clmEobyvsClDiJCLUj<})y`YHerWm@LJp3jpVU437W+ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Inbox.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Inbox.class new file mode 100644 index 0000000000000000000000000000000000000000..4e08a720a2d165681ebdcc677f9674df75d5ee33 GIT binary patch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Onr*2n`k2&8U1Rky&` zOi5m=k3TDCfe{*73w@$t#N-aqDJCcHSsJZpX`-Gb>B+W%)&lqGIZL;nXhn#ukvaiO ze}|g>2<0uJUl84ob)Mkzw{dcgH#obcGegcygY&9%ras|X4MVAP4P&YC8WO2Y4QcXb zYnXmdMOraO&l&nYfjE^NMJG}2Bf?`uF-yBRi!^d{dO~}*g$e9n68p4!&oPC0LZy7N zSil3i5pAzo=AC4_QVK(^Fx6V5b3fXCQ<0E@VFeNY545ZFBLN;_ur7m6R%QvOK49n_ z9a=o9QY%SVme%}$dTEA7SR#+qun|0V9y}KaUJe8&&Vv^N!MQ+i`aF0!5WGT4Hq)Ly N4_*rduX@U?{Q;9ILF@nk literal 0 HcmV?d00001 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Role.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Role.class new file mode 100644 index 0000000000000000000000000000000000000000..8d6c32ea9233165043bdc30cdfd4f45d6854a2b2 GIT binary patch literal 1181 zcmb7DZBNrs6n^g7u4^f5OhlRZ!i&0&mpb3Rj1U$w1IYlh!ji=grW;o%c3sl7B!2TJ z=}3fVG<^0)8PDxzoIw+}q&+?Np69veJonl6AD_PgsNji;1Vh0O{mAOR3wb*VPu;hk z>mOMmciPXbcIS|LT`TJHz^ZjTu7N=|pdiUGw!2r`DOX<~*p(W?a`pdNN`fY3Koc~^ z=2p43z2As=#KxEb1LF+pV!d2FsMriEuSOx)kw!+vxPeJz8I+dS@j1g(-mIQDr;g=0 zG~QnGgtx+yjwxJMF>T-mZZb^#E~xlXn|e5Pyom3;VR)7wLT`Fbw_6%ou)}~vD-E9@ z2x9)6fm@hmNUpiQ8?G}<4^s`0+h#olMW^v|DQF_j8JNd{kRk4&%V6crk%XWle?jF< zx=4m})%E#q)Nb-%-)VZZvhkN*%u&>4$W}Wo$E!PmD<}uNvhTEsK6_OohRhBRk2{Ai zoq%dW9?)oVc1_!YCl9lsD_-lC>7uF_vw8h)amOHcFf8B?jH@L_v$caK+%7 zu=A?8?~Nj8=y$m1Ts0{MA}g(U&I2{-KT7xqWI}O=$|lgiS!4`7#`3& z8Sl{*lA#_V5!XMZC=hy<6)te?5=_)5{;1E>iqWrvi2`Ly^e6;-FG|TkkYchTMTxf5 z!qV(HW6El*P(DR} zz!x9XNJuo%M-x9v+-KS{mGptWoa^3e?X~tffBt^|31AbeVFVCVp+wP#euhOyIBvdi zB6!sm$JU{3Ic8pPqk2DIt-axPBkwkNJ+B*%=^7?yP&aqC^zFiPhP!%ixoZ)G5LOY1 zVgS)AQx~`pR8)hZf8BB{@rYqHQ|gtwlr2Uuh#?ijl0MEbd|(_Kd7FggUzQJeMKA<2 z*`kUOhO~dTZQI;5?5B0pt#U_fzN_#fVbz=vMj6K2zN9LKsHIW{>muZgp<%~6~itXbxZDBhl<#@DCw$=YdgQj5Gx3ya=2q0 zwUCBH%`|PU`-P7*PoB1GYswj{?2`iCwuxam(`)ClMTP-~zx6Q&tVRbhHLXMuCKrCh zQYPCg4MA9qi|QF7g_>Kh@Mo5EGuF0ZQMM9u)Qv&w>B6)_fU)tm;CbZlsrnTu)q$GL}5`6|LjkA=Ok}rs!E}9${u^O{&fbNKp}DDgrW)A$uWqj|9oHxTbx>#0RL#M<_w6&#$Vf zIfr4~>ChZ+RUkQ%2oh*3hw&IAc;YdRdCg5;Seqol{e&zf2Ehhtxrls=O3u=_KIz*hS_Hfn n%6MR-LqT5)kA5=lbxEH7d?|UWYw}W8=G0~87hRK=J&Kiod>1+S literal 0 HcmV?d00001 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class new file mode 100644 index 0000000000000000000000000000000000000000..3a155f92f0d324c28866844af1a908de60cee3eb GIT binary patch literal 2320 zcmbVOZBr9h6n<_9Ko1Ey6RM1g^9>Ud$AqX z$*HX-Onf3%8MoqizTl3UIELd2qdz%8@N=!cciRc}<*Lh@?{_S4%Z<7hzOcW42edSV zJWgbB(!^)@Tw&qR3<^h{xS_bvVpfZuknccz2hqETm>Fm^NzAFb8 zOibgV!eHQrA+r-G%zq%@?w8n(5jvqo6BcHeP_J65{h}~;K#~nH*ZG<=aS1j9_kvx= z_x3u0UrY$RKkniq$@+l8AF+8y7yZT`dGh{uOiaw7a!}l*Xm3*KOu?pCb+;Ool3Rb^ zlzc7YTG{b;ow_Ic_%I#rdwj3i170JQv&5HfX@ZYMjcu@yCJM2RIw@1g^5d4Sp~=?g z?kXY?4c4T5BHQ~^l)^9%Tf$ISB=V3si+Hsx6zl`zBOTEb>NxWHXo6}a$HTPfXiIb- z2QgCKcgxQ@pArck(ZA&~dy{TsL)*1Rz3i@g5_(P&d`VgordU}iHpM}lkgmejgfuzM zDd|pnX8+MM3srw-UFwZ-_y>J1idBX)-%-{>| zzT^npk8b1c3U|C$N1^me;*b~@rIXSxS$)M-TCXIUj9y7RhF(cTSw`|TzKP?pISX6H zdX4OFTtqG!`tYiDK@vcN*ad~FSmKE!qZ>TZ3tmYCFDHV>d%-sn!QUo=r+UHbiQpA{ zm*DpKUhthn@HJdd02g|}TZ!NsxEX_2m|l4?LzFYpQH1<%0}q(w9nEkovTDD&p*1Tn zwc6%d<%aTk}-<}$SYgliqQ z;z+Nxyc6fBty6C>`zyWemRG5Zt>3dj+@@+Hp`Fu_0>ghH|L`s5Utv<*<6i@gkygjJ J+t3%>`5zRT*|`7! literal 0 HcmV?d00001 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/security/PasswordHasher.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/security/PasswordHasher.class new file mode 100644 index 0000000000000000000000000000000000000000..e454773c8dd1e84d32bd2397f0695b732674173c GIT binary patch literal 2772 zcmb7`*Xqe#4gr)mxm;az| zed~)4T|OV6#ZP_fL;s<^wf)`6LQs6@2R<`r=AL`*Io~-;{`%+lKLGUNyD)0t)8N+; zKu{q1$XGIxIm5~%Z_hrGX;&b4-Ly=%Q^42II2lF=wHm@YBG9*~kGr;MWdtZV4PMo>9>nSL$-iu;%g$9bwetn1Srl8cxx^+Ov{O+pCLiKItsVbaFJ+J1AGjDJs}! zbezRGfry*$&Kh=?Z5yis{)WbxZXd+cAHq0^CPm~t&uEzGo=FW1C<@I2`$kiPJ$;w& znQpd!!AOtycU`{P7Df^mHC)nh8La~K+s*0*U^SzaLFo_(?wTpA{)ezhG88exGiwV%c~s} z2~>K~P2|hfcR;09m4~Ie&~Qg!uV=@r?MmHg7%wNTw=h<)TysHI) zC7K6#sNp>w24;6cQ!x{q^9(XOsy|}6Ps}hA<{&l9>&PH0aKwXC$-`mkI7UYHm>KD? z2ePU4J}DSEN(4;A(;++(NK}JaGIHje;l9MC9zLdCH$xNHJ!D#Pq_8k6?FmIeAU2dw z8@WltHq~?KrQgk(>=La*|GR5-@C>HBYGLJeCUADA_^Uoj2?@P)j2vUFnMo;`{YT)K zr&lTNm--Wr)8@;a;`nyeSNZ^Ls?=eDsavTN3NqMV&x;_1 zC_Ss^uZCmTj}u%y!>6-2jYeEU6FPAoLug?uN#Z^(B8yh;Z=;1PDBvnSrIw2RK1X{! zCg5Mvu3D2Hfym8(J8I*#`#Y1E0}1ANFGq*EfNq>u2i=jkJSLaBzQ zfS&mywg0ls@K@164I%zRXc&!9^E2)#vc5t4wbXXDSOG|89%ODQ5VtufM{yH(I7ue>cNY(Fk2|Lbc-jLxk1+MeJWxJwmqP33z7`K{fVrZ(#0Yo-YKedj> lzv6((eNmPBd#Umj-__tLzUDnfX^<1-8-9fcynl<@{{WZ#th@jK literal 0 HcmV?d00001 diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest$getHashPasswordTest.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest$getHashPasswordTest.class new file mode 100644 index 0000000000000000000000000000000000000000..40476931164b97787fadaf1556b44eef9215e85c GIT binary patch literal 2725 zcmbVO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UKwWXD2v? LO~M75Vhi{LR*u_M literal 0 HcmV?d00001 From ab584acddb3ef2821736be2cd69785a1e2c40111 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Tue, 3 Mar 2026 18:57:30 +0100 Subject: [PATCH 05/25] Feat: Added file (CharityTest) and repo structure for UnitTesting --- .../java/ntnu/systemutvikling/team6/models/CharityTest.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java new file mode 100644 index 0000000..741f716 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java @@ -0,0 +1,4 @@ +package ntnu.systemutvikling.team6.models; + +public class CharityTest { +} From 5ed46ad955ff2652834610cb9c8091cf5dbd3444 Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Tue, 3 Mar 2026 19:04:20 +0100 Subject: [PATCH 06/25] Added exeption handling in User --- .../team6/models/user/User.java | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java index 654fff6..28c5934 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java @@ -4,7 +4,6 @@ import java.util.UUID; -// TODO: Unntakshåndtering mangler // TODO: Enhetstesting mangler /** @@ -19,7 +18,7 @@ public class User { private String name; private String email; private String passwordHash; - private final String role; + private final Role role; private final Settings settings; private final Inbox inbox; @@ -39,9 +38,32 @@ public User(UUID id, String name, String email, String password, - String role, + Role role, Settings settings, Inbox inbox) { + if (id == null) { + throw new IllegalArgumentException("ID cannot be null."); + } + + if (name == null || name.isBlank()) { + throw new IllegalArgumentException("Name cannot be null or blank."); + } + + if (email == null || email.isBlank() || !email.contains("@") || !email.contains(".")) { + throw new IllegalArgumentException("Email cannot be null or blank, and must contain '@' and '.'"); + } + + if (role == null) { + throw new IllegalArgumentException("Role cannot be null"); + } + + if (settings == null) { + throw new IllegalArgumentException("Settings cannot be null"); + } + + if (inbox == null) { + throw new IllegalArgumentException("Inbox cannot be null"); + } this.id = id; this.name = name; @@ -66,7 +88,7 @@ public String getEmail() { return email; } - public String getRole() { + public Role getRole() { return role; } @@ -81,6 +103,9 @@ public Inbox getInbox() { // Add Setters public void setName(String name) { + if (name == null || name.isBlank()) { + throw new IllegalArgumentException("Name cannot be null or blank."); + } this.name = name; } @@ -89,6 +114,9 @@ public void setPassword(String password) { } public void setEmail(String email) { + if (email == null || email.isBlank() || !email.contains("@") || !email.contains(".")) { + throw new IllegalArgumentException("Email cannot be null or blank, and must contains '@' and '.'"); + } this.email = email; } From 7e627032d42a5df75e5a533cf588d79baf8654e8 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Tue, 3 Mar 2026 19:44:53 +0100 Subject: [PATCH 07/25] Feat: Added UnitTest for Charity class with JavaDoc --- .../team6/models/CharityTest.java | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java index 741f716..7e25bc7 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java @@ -1,4 +1,68 @@ package ntnu.systemutvikling.team6.models; +import ntnu.sytemutvikling.team6.models.Charity; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * UnitTesting for Charity. + * + * @author Adrian Balunan + */ public class CharityTest { + private Charity charity; + + @BeforeEach + public void setup(){ + charity = new Charity("Charity1", "Something Somewhere Somehow", "Cancer"); + } + + /** + * Getters should work: + */ + @Test + public void gettingIdShouldWork(){ + assertInstanceOf(UUID.class, charity.getId()); + } + @Test + public void gettingCategoryShouldWork(){ + assertEquals("Cancer", charity.getCategory()); + } + @Test + public void gettingNameShouldWork(){ + assertEquals( "Charity1",charity.getName()); + } + @Test + public void gettingDescriptionShouldWork(){ + assertEquals("Something Somewhere Somehow",charity.getDescription()); + } + + /** + * Getter and setter for IsVerified should be able to switch between true and false + */ + @Test + public void isVerifiedReturnsCorrectly(){ + assertFalse(charity.isVerified()); + charity.setVerified(); + assertTrue(charity.isVerified()); + charity.setUnverified(); + assertFalse(charity.isVerified()); + } + + /** + * totalDonations should display accuratly and adding works + */ + @Test + public void totalDonationsReturnsCorrectlyAfterChanges(){ + assertEquals(0, charity.getTotalDonations()); + charity.setTotalDonations(10); + charity.setTotalDonations(5); + assertEquals(15, charity.getTotalDonations()); + } + } From 1bb6914324760208171513250bf1dbed0b16643f Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Tue, 3 Mar 2026 19:52:54 +0100 Subject: [PATCH 08/25] Added Junit tests to User --- .../team6/models/user/UserTest.java | 218 ++++++++++++++++++ .../team6/models/user/User.class | Bin 2320 -> 3369 bytes ...UserTest$constructorTests$emailTests.class | Bin 0 -> 3560 bytes .../user/UserTest$constructorTests.class | Bin 0 -> 6802 bytes .../team6/models/user/UserTest.class | Bin 0 -> 571 bytes 5 files changed, 218 insertions(+) create mode 100644 helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java create mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests$emailTests.class create mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests.class create mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest.class diff --git a/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java b/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java new file mode 100644 index 0000000..5fa92c8 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java @@ -0,0 +1,218 @@ +package ntnu.sytemutvikling.team6.models.user; + +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +class UserTest { + + @Nested + class constructorTests { + private final UUID validID = UUID.randomUUID(); + private final String validName = "Name"; + private final String validEmail = "Email@gmail.com"; + private final String validPassword = "Password"; + private final Role validRole = Role.NORMAL_USER; + private final Settings validSettings = new Settings(); + private final Inbox validInbox = new Inbox(); + + @Test + void shouldThrowIfIdIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + null, + validName, + validEmail, + validPassword, + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfNameIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + null, + validEmail, + validPassword, + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfNameIsBlank() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + " ", + validEmail, + validPassword, + validRole, + validSettings, + validInbox + )); + } + + @Nested + class emailTests { + + @Test + void shouldThrowIfEmailIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + null, + validPassword, + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfEmailIsBlank() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + " ", + validPassword, + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfEmailDoesNotContainAt() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + "test.gmail.com", + validPassword, + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfEmailDoesNotContainPeriod() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + "test@gmailcom", + validPassword, + validRole, + validSettings, + validInbox + )); + } + } + + @Test + void shouldThrowIfPasswordIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + validEmail, + null, + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfRoleIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + validEmail, + validPassword, + null, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfPasswordIsBlank() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + validEmail, + " ", + validRole, + validSettings, + validInbox + )); + } + + @Test + void shouldThrowIfSettingsIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + validEmail, + validPassword, + validRole, + null, + validInbox + )); + } + + @Test + void shouldThrowIfInboxIsNull() { + assertThrows(IllegalArgumentException.class, () -> + new User( + validID, + validName, + validEmail, + validPassword, + validRole, + validSettings, + null + )); + } + + @Test + void shouldCreateUser() { + User user = new User( + validID, + validName, + validEmail, + validPassword, + validRole, + validSettings, + validInbox + ); + + assertAll( + () -> assertEquals(validID, user.getId()), + () -> assertEquals(validName, user.getName()), + () -> assertEquals(validEmail, user.getEmail()), + () -> assertEquals(validRole, user.getRole()), + () -> assertEquals(validSettings, user.getSettings()), + () -> assertEquals(validInbox, user.getInbox()) + ); + } + + } +} \ No newline at end of file diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class index 3a155f92f0d324c28866844af1a908de60cee3eb..e981ecb29753f548c70640e8cfa7b8d65e4f2e66 100644 GIT binary patch literal 3369 zcmb7G-E$LF6#v~e?WW1L#X!N*Rs$$$zM2AxU<$U-Vxy%Xp%E%5n`CXb-E2yBQ(&BN zeDTFUKnKPrpJc`d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j9_kvx= z_x3u0UrY$RKkniq$@+l8AF+8y7yZT`dGh{uOiaw7a!}l*Xm3*KOu?pCb+;Ool3Rb^ zlzc7YTG{b;ow_Ic_%I#rdwj3i170JQv&5HfX@ZYMjcu@yCJM2RIw@1g^5d4Sp~=?g z?kXY?4c4T5BHQ~^l)^9%Tf$ISB=V3si+Hsx6zl`zBOTEb>NxWHXo6}a$HTPfXiIb- z2QgCKcgxQ@pArck(ZA&~dy{TsL)*1Rz3i@g5_(P&d`VgordU}iHpM}lkgmejgfuzM zDd|pnX8+MM3srw-UFwZ-_y>J1idBX)-%-{>| zzT^npk8b1c3U|C$N1^me;*b~@rIXSxS$)M-TCXIUj9y7RhF(cTSw`|TzKP?pISX6H zdX4OFTtqG!`tYiDK@vcN*ad~FSmKE!qZ>TZ3tmYCFDHV>d%-sn!QUo=r+UHbiQpA{ zm*DpKUhthn@HJdd02g|}TZ!NsxEX_2m|l4?LzFYpQH1<%0}q(w9nEkovTDD&p*1Tn zwc6%d<%aTk}-<}$SYgliqQ z;z+Nxyc6fBty6C>`zyWemRG5Zt>3dj+@@+Hp`Fu_0>ghH|L`s5Utv<*<6i@gkygjJ J+t3%>`5zRT*|`7! diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests$emailTests.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests$emailTests.class new file mode 100644 index 0000000000000000000000000000000000000000..51a8c3c7dae55e114272893cb6e906b851d467b8 GIT binary patch literal 3560 zcmbtWYgZFT7=DJ^hPX(K)`GPbX|xcO#a`?swi<2{8zUtN*4o-`k^vSrJ7ISg#ZUc9 zJ;xqBdQN{pPe1hs_4J+HK!TF696n@c-pM=9^Uiyl`TM`ue*sv)a}7NVw;k#DhPNwu z-IqJomTfufhU8}brcoC)ZhMCBan~r*r^G#(stU)Gu3wcRki9ti(63=YhlUu#nN4%Y zG<<2<#)HZxuS$>Mw9B`B%jE^(6nxuexH^#!)NGTuLbc4~yGw(JW z%enbX3{wn!1+&g$xXv&nDTnT?t8A)@dJG0bY?+SpRJb*Tctgjh_>5sNKwJ?v#qCCELozR_roC#qmXe!`eX2t-$EbF;Zg^u z7s%YAapdaec;-&oE@>njeHP0A~V-a^`_WmI7NxslKyGG zHJY13+m=kHW^*r<7h=nAbZ6g;$=Q0QXxL%6(n`()h8{e=2I}aSx~tMdB=i-=C`buDWuT#P`QczJ*_D2JdMEp4xpD0 z2Q3lUlOsV39YDtq2dxmOeI)3E4xk?&4%#5l=iNaQJ*vin`(Od2ZHP);1wdH^6pM{`xs=^Bgm+;bSKLm zgRFc688x*gS*hv9^Z_@rV{qMV<4V8nMfBq#d9(*VVlR&$k^EDz_87m=m?nR3QSm*& juk;INmHiptpKZ|0CH)Je%kUT;&EqtaH2QdoU5x$@t(>{* literal 0 HcmV?d00001 diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests.class new file mode 100644 index 0000000000000000000000000000000000000000..e7def3c7dea39376de39934c3b6c605f9dc1b659 GIT binary patch literal 6802 zcmbtY`F|8=8UId5vdLxwVS%=xNNC+cvT0e4g4RVKq(M?cKo)|CS|__hSeV@jyR#f# z#iP}##kSQZts8QMoV8KGoZh~%DCS~b1YIiT zBSx)NOZMy;zFtAJs1>qi-eF?Bu0q>X`Ic(OLM)2l5*3%?G6kCoR-v3Mov`$L**cm# zY~*OHrEB^1$-J4>jZ(5)(u>JGeC*asRy<=CN>;I)u}quix+6z5BbOD`UC!dFy4tW< zLG!4V*G20R6)(V21?~0(`Klo1+mEzWr1Df7mMNGwl-F{`<_USO%$RwZf2E2S%KWH3 z-xg@YRSMd6YNgUKvzQg36)Ji~sM8jzjwH|@!PP3R!Ab>*aEsn$8Z@zEbjPmk10y%? zNe}H(aP>&|x%OVKQn6ZeI;$4Q2-YfC84f0`TNXE^6vY~}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L#DF;*$tuhh( zlTln};WM{0f`8NV8;i0SI(v_0JoGl+Xd;No<(pJYZp7^5-%7d(-Q;=0_4pq0yv%xh zoILN6_B>t!?Kf{?d<#|w-bReKle(QZf+oJV^zWO7vUhLd3?hkXbWUMGBGx^H%M-Dl zDO{0=#iy`5aT(q%!Jv0h{N7nXKU4?w6~Um)=lJ@p zpdYRSx+@s;48!K#;e{xm$3{y%2;~><9Nii!OX;=nWxRW(TT0MGi6RWEYIKLq(MN;LC* zH*s0P0&v$6w-A8)OlVxz$pG9Waf<=CPlv{3HFj|~@-6!ijr9=qXaMSYA8ORwg=oMo zu;SOCb`$mW0jN)fMrBvwqWaHl0de0HfcvBmxAB>=cX4sI(uw7~mjpYpLJ#)kUdK14 zZ9PujUE=PF-y_&3&5o|P@lk_*-z@0t$z1ed*Y=(nwx1-hKLBeK-0f4)6JS1Dz{ci_ z>6P%VK|kd~5852In=bk`*Zie^^98%1^(TG!O9QNDb6algdbYqp>NhklX1-h?lCx$(>7zhZy8ACd!4v1j=W zbL?r>m(wowphtbfqrT};-}0#Mc+{gF^+S*Pu}A&Xqn`4pXFTdTkNPF4Khvhgv}Ymi T$6rYQmDJz){s;br|DgN-7mm4y literal 0 HcmV?d00001 diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest.class new file mode 100644 index 0000000000000000000000000000000000000000..810d4b9c1a1ad74452dac74f086ad3201173e017 GIT binary patch literal 571 zcmbtRyG{c!5F95V2YHZ?@G2=%00pL^0YMRg1PY-5(mRI*4nCiB_C?~esE{c506q#a z7eGjK5w^TLJ6_Ftz3(5dZvalQSwjis2$cpFP!(uT)Kp2U+`YUSPjnmvsz=6|a4b;X z-Wf$$6xegY< Date: Tue, 3 Mar 2026 21:19:37 +0100 Subject: [PATCH 09/25] Wrote javadoc to User --- .../team6/models/user/User.java | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java index 28c5934..ba4a298 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java @@ -1,13 +1,15 @@ package ntnu.sytemutvikling.team6.models.user; -import ntnu.sytemutvikling.team6.security.PasswordHasher; - import java.util.UUID; - -// TODO: Enhetstesting mangler +import ntnu.sytemutvikling.team6.security.PasswordHasher; /** - * Represents a user. + * Represents a user in the system. + * + *

A user has a unique identifier, personal information, a hashed password, a role, + * settings and an inbox. + * + *

The password is never stored ad plain text. It is hashed using {@link PasswordHasher} * * @author Robin Strand Prestmo */ @@ -23,7 +25,7 @@ public class User { private final Inbox inbox; /** - * Creates a new user + * Creates a new user. * * @param id gives the user a unique identifier with UUID * @param name the name of the user @@ -32,7 +34,7 @@ public class User { * @param role users role * @param settings the user´s settings * @param inbox the user´s inbox - * + * @throws IllegalArgumentException if any required argument is invalid. */ public User(UUID id, String name, @@ -50,7 +52,8 @@ public User(UUID id, } if (email == null || email.isBlank() || !email.contains("@") || !email.contains(".")) { - throw new IllegalArgumentException("Email cannot be null or blank, and must contain '@' and '.'"); + throw new IllegalArgumentException("Email cannot be null or blank," + + " and must contain '@' and '.'"); } if (role == null) { @@ -102,6 +105,12 @@ public Inbox getInbox() { // Add Setters + /** + * Updates the users name. + * + * @param name the new name + * @throws IllegalArgumentException if the name is null or blank + */ public void setName(String name) { if (name == null || name.isBlank()) { throw new IllegalArgumentException("Name cannot be null or blank."); @@ -109,19 +118,39 @@ public void setName(String name) { this.name = name; } + /** + * Updates the users password. + * + *

The password is hashed before being stored. + * + * @param password the new password + */ public void setPassword(String password) { this.passwordHash = passwordHasher.getHashPassword(password); } + /** + * Updates the users email. + * + * @param email the new email + * @throws IllegalArgumentException if the email is null, blank, or does not contain '@' or '.' + */ public void setEmail(String email) { if (email == null || email.isBlank() || !email.contains("@") || !email.contains(".")) { - throw new IllegalArgumentException("Email cannot be null or blank, and must contains '@' and '.'"); + throw new IllegalArgumentException("Email cannot be null or blank," + + " and must contains '@' and '.'"); } this.email = email; } // Other methods + /** + * Checks if the provided password matches the stored password. + * + * @param password the password to verify + * @return true if the password is correct, false otherwise + */ public boolean checkPassword(String password) { return passwordHasher.isValidPassword(password, passwordHash); } From 30c5e48ed8151b9f7bdae0ade5b1c756ab1927c1 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Wed, 4 Mar 2026 15:29:11 +0100 Subject: [PATCH 10/25] Feat: Added UnitTest for CharityRegistry class --- .../team6/models/CharityRegistryTest.java | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java new file mode 100644 index 0000000..d994bb4 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java @@ -0,0 +1,87 @@ +package ntnu.systemutvikling.team6.models; + +import ntnu.sytemutvikling.team6.models.Charity; +import ntnu.sytemutvikling.team6.models.CharityRegistry; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; + +public class CharityRegistryTest { + private CharityRegistry registry; + private Charity charity; + + @BeforeEach + public void setup(){ + registry = new CharityRegistry(); + charity = new Charity("Charity1", "Something Somewhere Somehow", "Cancer"); + } + + + @Test + void testAddCharitySuccessfully() { + registry.addCharity(charity); + + assertEquals(1, registry.getAllCharities().size()); + assertTrue(registry.getAllCharities().contains(charity)); + } + + @Test + void testAddCharityNullThrowsException() { + assertThrows(IllegalArgumentException.class, () -> registry.addCharity(null)); + } + + @Test + void testGetAllCharitiesReturnsUnmodifiableList() { + registry.addCharity(charity); + + List charities = registry.getAllCharities(); + assertThrows(UnsupportedOperationException.class, () -> charities.add(charity)); + } + + @Test + void testFindCharityByIdFound() { + registry.addCharity(charity); + + Optional result = registry.findCharityById(charity.getId()); + + assertTrue(result.isPresent()); + assertEquals(charity, result.get()); + } + + @Test + void testFindCharityByIdNotFound() { + Optional result = registry.findCharityById(UUID.randomUUID()); + assertTrue(result.isEmpty()); + } + + @Test + void testFindCharityByIdNullThrowsException() { + assertThrows(IllegalArgumentException.class, () -> registry.findCharityById(null)); + } + + @Test + void testRemoveCharitySuccessfully() { + registry.addCharity(charity); + + boolean removed = registry.removeCharity(charity.getId()); + + assertTrue(removed); + assertTrue(registry.getAllCharities().isEmpty()); + } + + @Test + void testRemoveCharityNotFound() { + boolean removed = registry.removeCharity(UUID.randomUUID()); + assertFalse(removed); + } + + @Test + void testRemoveCharityNullThrowsException() { + assertThrows(IllegalArgumentException.class, () -> registry.removeCharity(null)); + } +} From 0baccdda69b9e55327f10d6a20fdf4f4e7f72e0b Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Wed, 4 Mar 2026 15:38:15 +0100 Subject: [PATCH 11/25] Feat: Added JavaDoc for when necessary in CharityRegistry in Test class --- .../systemutvikling/team6/models/CharityRegistryTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java index d994bb4..5176235 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java @@ -11,10 +11,17 @@ import static org.junit.jupiter.api.Assertions.*; +/** + * UnitTest for CharityRegistry class + * + * @author Adrian Balunan + */ + public class CharityRegistryTest { private CharityRegistry registry; private Charity charity; + /* Setting up variables */ @BeforeEach public void setup(){ registry = new CharityRegistry(); From 7d6fe90dc54a69e9f6588137671a1ac0a317f358 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Wed, 4 Mar 2026 15:38:51 +0100 Subject: [PATCH 12/25] Attempt Feat: DonationTest but User is fully developed --- .../team6/models/DonationTest.java | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java new file mode 100644 index 0000000..c96da2c --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java @@ -0,0 +1,115 @@ +package ntnu.sytemutvikling.team6.models; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; + +class DonationTest { + private Settings settings; + private User User; + private Charity charity; + + // -- Setup -- + @BeforeEach + public void setup(){ + charity = new Charity("name", "something somewhere somehow", "Meow"); + User = new User() + } + + + // --- Tests --- + @Test + void testDonationInitialization() { + Charity charity = new Charity(); + User user = new User(new UserSettings(true)); + LocalDateTime now = LocalDateTime.now(); + + Donation donation = new Donation(500.0, now, charity, user); + + assertNotNull(donation.getCharityId()); + assertEquals(500.0, donation.getAmount()); + assertEquals(now, donation.getDate()); + assertEquals(charity, donation.getCharity()); + assertEquals(user, donation.getDonor()); + } + + @Test + void testAnonymousFlagWhenUserIsAnonymous() { + User user = new User(new UserSettings(true)); + Charity charity = new Charity(); + Donation donation = new Donation(100, LocalDateTime.now(), charity, user); + + // According to your logic: + // if donor.getSettings().isAnonymous() == false → donation.isAnonymous = true + // else → donation.isAnonymous = false + // + // So if user.isAnonymous() == true → donation.isAnonymous should be false + assertFalse(donation.isAnonymous()); + } + + @Test + void testAnonymousFlagWhenUserIsNotAnonymous() { + User user = new User(new UserSettings(false)); + Charity charity = new Charity(); + Donation donation = new Donation(100, LocalDateTime.now(), charity, user); + + // If user.isAnonymous() == false → donation.isAnonymous = true + assertTrue(donation.isAnonymous()); + } + + @Test + void testCharityIdIsUnique() { + Charity charity = new Charity(); + User user = new User(new UserSettings(true)); + + Donation d1 = new Donation(50, LocalDateTime.now(), charity, user); + Donation d2 = new Donation(75, LocalDateTime.now(), charity, user); + + assertNotEquals(d1.getCharityId(), d2.getCharityId()); + } + + @Test + void testAmountStoredCorrectly() { + Charity charity = new Charity(); + User user = new User(new UserSettings(true)); + + Donation donation = new Donation(123.45, LocalDateTime.now(), charity, user); + + assertEquals(123.45, donation.getAmount()); + } + + @Test + void testDateStoredCorrectly() { + LocalDateTime date = LocalDateTime.of(2024, 5, 10, 12, 30); + Charity charity = new Charity(); + User user = new User(new UserSettings(true)); + + Donation donation = new Donation(200, date, charity, user); + + assertEquals(date, donation.getDate()); + } + + @Test + void testCharityStoredCorrectly() { + Charity charity = new Charity(); + User user = new User(new UserSettings(true)); + + Donation donation = new Donation(200, LocalDateTime.now(), charity, user); + + assertEquals(charity, donation.getCharity()); + } + + @Test + void testDonorStoredCorrectly() { + Charity charity = new Charity(); + User user = new User(new UserSettings(true)); + + Donation donation = new Donation(200, LocalDateTime.now(), charity, user); + + assertEquals(user, donation.getDonor()); + } +} \ No newline at end of file From 7fa860326bfb357d6a02b908a083ba2395b7279f Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Wed, 4 Mar 2026 16:03:46 +0100 Subject: [PATCH 13/25] Feat: Added SettingsTest --- .../team6/models/SettingsTest.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java new file mode 100644 index 0000000..3221be5 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java @@ -0,0 +1,72 @@ +package ntnu.systemutvikling.team6.models; + +import ntnu.sytemutvikling.team6.models.Language; +import ntnu.sytemutvikling.team6.models.Settings; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class SettingsTest { + + @Test + void testDefaultConstructorSetsStandardValues() { + Settings settings = new Settings(); + + assertTrue(settings.isLightMode()); + assertEquals(Language.ENGLISH, settings.getLanguage()); + assertFalse(settings.isAnonymous()); + } + + @Test + void testCustomConstructorSetsValuesCorrectly() { + Settings settings = new Settings(false, Language.ENGLISH, true); + + assertFalse(settings.isLightMode()); + assertEquals(Language.ENGLISH, settings.getLanguage()); + assertTrue(settings.isAnonymous()); + } + + @Test + void testConstructorThrowsExceptionWhenLanguageIsNull() { + assertThrows(IllegalArgumentException.class, + () -> new Settings(true, null, false)); + } + + @Test + void testToggleLightMode() { + Settings settings = new Settings(true, Language.ENGLISH, false); + + settings.toggleLightMode(); + assertFalse(settings.isLightMode()); + + settings.toggleLightMode(); + assertTrue(settings.isLightMode()); + } + + @Test + void testToggleAnonymousMode() { + Settings settings = new Settings(true, Language.ENGLISH, false); + + settings.toggleAnonymousMode(); + assertTrue(settings.isAnonymous()); + + settings.toggleAnonymousMode(); + assertFalse(settings.isAnonymous()); + } + + @Test + void testChangeLanguageSuccessfully() { + Settings settings = new Settings(); + + settings.changeLanguage(Language.ENGLISH); + assertEquals(Language.ENGLISH, settings.getLanguage()); + } + + @Test + void testChangeLanguageThrowsExceptionWhenNull() { + Settings settings = new Settings(); + + assertThrows(IllegalArgumentException.class, + () -> settings.changeLanguage(null)); + } +} \ No newline at end of file From d3565a3e3e6484ff2b006978dd20d8c4f4d34252 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Wed, 4 Mar 2026 16:04:49 +0100 Subject: [PATCH 14/25] Fix: Better naming conventions --- .../systemutvikling/team6/models/CharityTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java index 7e25bc7..1707499 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java @@ -26,19 +26,19 @@ public void setup(){ * Getters should work: */ @Test - public void gettingIdShouldWork(){ + public void testGettingIdShouldWork(){ assertInstanceOf(UUID.class, charity.getId()); } @Test - public void gettingCategoryShouldWork(){ + public void testGettingCategoryShouldWork(){ assertEquals("Cancer", charity.getCategory()); } @Test - public void gettingNameShouldWork(){ + public void testGettingNameShouldWork(){ assertEquals( "Charity1",charity.getName()); } @Test - public void gettingDescriptionShouldWork(){ + public void testGettingDescriptionShouldWork(){ assertEquals("Something Somewhere Somehow",charity.getDescription()); } @@ -46,7 +46,7 @@ public void gettingDescriptionShouldWork(){ * Getter and setter for IsVerified should be able to switch between true and false */ @Test - public void isVerifiedReturnsCorrectly(){ + public void testIsVerifiedReturnsCorrectly(){ assertFalse(charity.isVerified()); charity.setVerified(); assertTrue(charity.isVerified()); @@ -58,7 +58,7 @@ public void isVerifiedReturnsCorrectly(){ * totalDonations should display accuratly and adding works */ @Test - public void totalDonationsReturnsCorrectlyAfterChanges(){ + public void testTotalDonationsReturnsCorrectlyAfterChanges(){ assertEquals(0, charity.getTotalDonations()); charity.setTotalDonations(10); charity.setTotalDonations(5); From 9b40a55e3a3031b5bac2bcf4cc858db95591e518 Mon Sep 17 00:00:00 2001 From: Robin Strand Prestmo Date: Thu, 5 Mar 2026 10:17:40 +0100 Subject: [PATCH 15/25] feat: added workflow --- .../.github/workflows/ci.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 helpmehelpapplication/.github/workflows/ci.yml diff --git a/helpmehelpapplication/.github/workflows/ci.yml b/helpmehelpapplication/.github/workflows/ci.yml new file mode 100644 index 0000000..ae74021 --- /dev/null +++ b/helpmehelpapplication/.github/workflows/ci.yml @@ -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 From 4ef68e8acc4908e2335167b1c847a2ec3fd619be Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 11:39:53 +0100 Subject: [PATCH 16/25] Fix: Simpler definisjon of Anonymous --- .../java/ntnu/sytemutvikling/team6/models/Feedback.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java index 2a0657e..abc7fc6 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java @@ -34,12 +34,7 @@ public Feedback(User user, String comment) { this.comment = comment; this.date = LocalDateTime.now(); - // ASSUMES that this is the way to get the anonymous setting from the user's settings. - if (user.getSettings().isAnonymous() == false) { - this.isAnonymous = true; - } else { - this.isAnonymous = false; - } + this.isAnonymous = user.getSettings().isAnonymous(); } /** From b13d42d87b654128f80d65167c4c358107cb05c5 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 11:43:10 +0100 Subject: [PATCH 17/25] Fix: Added FeedbackTest --- .../team6/models/FeedbackTest.java | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java new file mode 100644 index 0000000..f3e3e8d --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java @@ -0,0 +1,91 @@ +package ntnu.systemutvikling.team6.models; + +import ntnu.sytemutvikling.team6.models.Settings; +import ntnu.sytemutvikling.team6.models.User; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; + +class FeedbackTest { + + private User user; + private Settings settings; + + // -- Setup -- + @BeforeEach + public void setup() { + settings = new Settings(true); // default anonymous = true + user = new User(); + } + + // --- Tests --- + + @Test + void testFeedbackInitialization() { + LocalDateTime before = LocalDateTime.now(); + Feedback feedback = new Feedback(user, "Nice work!"); + LocalDateTime after = LocalDateTime.now(); + + assertNotNull(feedback.getFeedbackId()); + assertEquals("Nice work!", feedback.getComment()); + assertEquals(user, feedback.getUser()); + + // Date should be between before and after + assertTrue(!feedback.getDate().isBefore(before) && !feedback.getDate().isAfter(after)); + } + + @Test + void testAnonymousFlagWhenUserIsAnonymous() { + // user.settings.isAnonymous() == true → feedback.isAnonymous = false + settings = new UserSettings(true); + user = new User(settings); + + Feedback feedback = new Feedback(user, "Anonymous feedback"); + + assertFalse(feedback.isAnonymous()); + } + + @Test + void testAnonymousFlagWhenUserIsNotAnonymous() { + // user.settings.isAnonymous() == false → feedback.isAnonymous = true + settings = new UserSettings(false); + user = new User(settings); + + Feedback feedback = new Feedback(user, "Not anonymous"); + + assertTrue(feedback.isAnonymous()); + } + + @Test + void testFeedbackIdIsUnique() { + Feedback f1 = new Feedback(user, "First"); + Feedback f2 = new Feedback(user, "Second"); + + assertNotEquals(f1.getFeedbackId(), f2.getFeedbackId()); + } + + @Test + void testCommentStoredCorrectly() { + Feedback feedback = new Feedback(user, "This is a test comment"); + + assertEquals("This is a test comment", feedback.getComment()); + } + + @Test + void testUserStoredCorrectly() { + Feedback feedback = new Feedback(user, "Hello"); + + assertEquals(user, feedback.getUser()); + } + + @Test + void testDateIsSet() { + Feedback feedback = new Feedback(user, "Testing date"); + + assertNotNull(feedback.getDate()); + } +} \ No newline at end of file From b2c1072d99dbdfd1f744a11ab9c4a377f0b658b0 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 11:51:12 +0100 Subject: [PATCH 18/25] Merge: Clean up before merge --- .../sytemutvikling/team6/models/Charity.java | 2 +- .../team6/models/DonationTest.java | 6 +- .../sytemutvikling/team6/models/Charity.class | Bin 1676 -> 0 bytes .../team6/models/CharityRegistry.class | Bin 2899 -> 0 bytes .../team6/models/Donation.class | Bin 1787 -> 0 bytes .../team6/models/DonationRegistry.class | Bin 2924 -> 0 bytes .../team6/models/Feedback.class | Bin 1537 -> 0 bytes .../sytemutvikling/team6/models/Inbox.class | Bin 2879 -> 0 bytes .../team6/models/Language.class | Bin 1040 -> 0 bytes .../sytemutvikling/team6/models/Message.class | Bin 1549 -> 0 bytes .../sytemutvikling/team6/models/Role.class | Bin 1075 -> 0 bytes .../team6/models/Settings.class | Bin 1589 -> 0 bytes .../sytemutvikling/team6/models/User.class | Bin 1787 -> 0 bytes .../team6/models/UserRegistry.class | Bin 327 -> 0 bytes .../team6/service/CharityService.class | Bin 335 -> 0 bytes .../team6/service/DonationService.class | Bin 338 -> 0 bytes .../team6/service/FeedbackService.class | Bin 338 -> 0 bytes .../target/classes/tempClassDiagram.puml | 307 ------------------ 18 files changed, 4 insertions(+), 311 deletions(-) delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/CharityRegistry.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Donation.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/DonationRegistry.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Language.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Message.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Role.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/CharityService.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class delete mode 100644 helpmehelpapplication/target/classes/tempClassDiagram.puml diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java index 4a389f4..84fb639 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java @@ -9,7 +9,7 @@ import java.util.UUID; import java.util.ArrayList; -abstract class Charity { +public class Charity { /* UUID for uniquely identifying each charity */ private UUID id; diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java index c96da2c..dca66b7 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java @@ -1,4 +1,4 @@ -package ntnu.sytemutvikling.team6.models; +package ntnu.systemutvikling.team6.models; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -10,14 +10,14 @@ class DonationTest { private Settings settings; - private User User; + private User user; private Charity charity; // -- Setup -- @BeforeEach public void setup(){ charity = new Charity("name", "something somewhere somehow", "Meow"); - User = new User() + User = new User(); } diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Charity.class deleted file mode 100644 index 7803742166af7bb43fbb61fd5ac98d603e1aa5ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcma)5YflqF6g|_H7TOhg_(nxVpk1MhiccOsiX=@4MtLOgiKSiZXuE5+Qxg7(Kf({1 z*l0BI2l%6mXNC%O*+jqWy>n;InYrhl{rT(L4*<_l${-<-_m$srn)}LYwA7w_TbF*# zQJ&kl>okI@S8qC{*KR1)eg-Llfj91+>(pJIdA|F`t0;kltg^mhHd;#7osEt1(wsob zcN?C-(7}#@tf`Rf+{;zHW+jyGlni`UzR^IY#_suJ^smR{9CTrwsg}i>D>tT9(e&wJ2E_cZ17Ri;Km%dbs z0uS=X8~L9~VUtpnsALvNoV75Fa{|eHVKa*hxR}8R`~O=z3zu-20)(z#4H{Zas+ccy zHDVO*gTNIFJxJ^9nuQE{b#~oC-$6EEA&Z=@EDjY@X)F;R6nz&Zu<`sMITk#Ra~<$3<<-Kb?Gz_}H0i9F z&kOqRWfw#GQ1XQs2JM|F!xkB~V;L6lsPl#r9iZKiv$sBDd}N0{jMD7T%C4a~b8z&~ QRyjPT6}4ra7~P)!25&JWQ2+n{ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/CharityRegistry.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/CharityRegistry.class deleted file mode 100644 index 61b85038c64275096044f821b577e36bed01d1fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 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24pSmO_v-k)NIKkUCn(*NBPB-ih Jp5RAJ{tr(1?_K}^ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Feedback.class deleted file mode 100644 index 28853eca2459be072730105ee9d9b4a9cda23bf8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1537 zcma)5+fEZv6kVq+3=G3XE+RL%32mpqs33~1AaY4asy-BW;BDHDIMA7zc8cLw`~hD~ z)Wo9k!4L4G)ODtvMA{}alg!!Y%vyWxz0aE8e}4V~u!lVbA%VE-xfP>)=~+(2yRgp- zwtH%Lmg%e;PBCv4%ErEB<+En)TtP%&;LN-*je<$g>+G48^90m4b-+QM-_t&z;@Jh` z=;&ZKDG;fYt&%`AeWTJ5fg~uoqT^UDQxDd%`EnVr#L{HGyy;m2W3_Ld?N~;-m@^Bz zJU--(kRH3d?H1ijr&uWqh!cU%lVS#Wgeyrj) z?kE@)=)2y%hB1tDLM7A97achd_7saZ&Zrv#lNvhEDWkg@6m-dGMngAL6?3?!U|wL< z&)(dzh6OCL6u0smA{V}*k~wY-ewdAtb@c9~K) zvIBTh#eF=PzZ2MYIJkoA##M-sCZ)p} zNwael?ToPgU#OX4rIfSwZP{>dpuQqafmu!`%-^~LA?YJVA?YH2rHA~L*Y2+zA=gea z`Z2)wE$%)OFZpZwcMR%3FjB>Yo~U9OidF{u)!VG{hEaz$*Mzm%6JH& zzodl~2nD)=Bq$*84CD3U4X%>Zp?|}~7X~4}8rdPJC6%-qpspmai7lSU&i^M*H04LxtQB=7jB-GAn2M)Cjv diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Inbox.class deleted file mode 100644 index 72613e7b9d3b93e13c31cabfb4cd0b77c2d6076c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2879 zcmb7FYf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Jjg!d^OGP$io!!NM@0$)k&XqAGj1=Vg1 vq!R#j^LYURQFQ>6vAj=HK#|_EBs*j?VBwkn%Z7(Nd{1YxN%!#senRj6*qz`8 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Language.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Language.class deleted file mode 100644 index de22840e2faa5672993a34756d66b15239b7fbe3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1040 zcmb7CT~pIQ6g}INrVS~SqE#q?Ej#E@$wDV3TzQEi1jIjrw%?E>YN zRm>nKcDGc>$TQ5Fj%T-`LD%-*@vduAjyddcx6OS=oa3MZ33F66{Nw~wXvE#frp-o8 zo5qKN72KC`kD-*(Hx8&3Djwh=LxKA~ANPh|#teGe#ZmXf?uGUJl(Fj&Iis$`l8!zy z?4)6dd2Ncv7FJhPJi=3k7iq3Nmj^*TCE$j9Vn&Pz^;)rpk>9glJK{Nu*YmU?^2np* z^gSL%KHa@c(Fts03ZdKe-A(GFM6;dQT@q~tO3R|D6v@(BfS8V1I_=O|eAORdow6#O zqj-je>`yvLr&zGgu=tIxGq_EwLVpmrNEDSgDsE`P60%JyDT>Pa+R8cZOn^B`Kmt6e{`&~YeLFHl|oN;g+BuGrX(gaWnXal)Zfj;N)S WnSOyMzrg;D%ivke`5d+Qul)ru81$b2 diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Message.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Message.class deleted file mode 100644 index 12c1cec780b114eaf18df46e8009a8bff591b4a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1549 zcma)5+fEZv6kUh5Oc@5j3L+p_Etg2r~Iqbn~V@{DriHDA(TkwWpv`UgsyXK1|=)##vQ8HtgKKY2mbw+ z5_%biP8Hd-ETgPj%U-!^Q&a2jipC)~T_=jW3XR6hzQ0ym18*qQcV@v;^Ly0vS;m5AaCBLxyfY&*f<9}th z`c5)kzPBL4&naky!qA>I9pgpSE*M@;F9aJVRwS=`ra0HZFn?oK7}V@__nTI$ZHMc{ zgDw5A9wSmV_$F<4l&n8KhR%~J&+oHDH^gX2J@V=kAc1}2nZ=fO+^SbJHcU~sQvb3t zLLLlKk0JUnBZvuY$%_ePeM`FfmQ?jE2|>1*7;U&g&vrWfA$FLot{$T!^$T+93vPWt z+jsQr#rlrX|1(Ws`V1Hs;5dQfXTTu=s$VfugQ})#NUP}@GU|8@6NFCHF#Cy;gfLIf zX-W?aP}(6XVVG8U6eAcz1}f%|!YX;spn$YBzDn8GXCiUne+L9tlGV>(gUezVN? zM7vGCCmIf6iTqwP|Dz;f2~0v~@CRCC`jG%nkgUs~krh!Q>Sw4Q$!YRS6Mt$tw-XnTzD5hUC?Ty?O diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Role.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Role.class deleted file mode 100644 index f19f0d329763812b4a709a4241f91f6d46660b20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1075 zcma)4U2hUm5IvU#mX9q(wA6n1-CEdINFQusAWaFuNL(Oc3kmVTTyU*hm&Gi*B>XF- z4{bCyKKrALbGMtqgC^|5-kCdd&YZb3zyEx{22evmMu=h8c5SaXp1Q`+b0_9!%e2pm zuEB>##o_3KVU3IJk!8pTGo;S>gcmJN2{qdrG9;U=cB7)b@94EQ!=APjRf$2VzNxh9 zr@a7}tTj80oo+?z)O3d2yQO(zK?KnlWZ`5L$cPH-zJeIyM5URw(e#FW!#U-B%V5Z8qXDI%rRA+aLY5uP;>cZ8%p3Yp2~Q_kX{fv9n)wOJi`t{oI4Jm4n|+5f_R~w zR{z`>xTX3(uBb%@*_YG$$WU5@1+S1_^2J4qIR(4OGrU~nsakwIE-e(lC7w4TR)%Ju z&_|v#FkYMD8RKHN3L=MW-8{3o>p67)YJp1N%1a77E}b0G+$7p>>10F96rhvF38Xj0 zFewtIGl3-KDdcs@7hmBASTD08T_SaXjPKkF`_5YACxxULGI}pO!2g-VT1lD zzgiqC#3?Fl`VkSO?F(ugQjX9htNYuR*qVc*lz;%F__mB~A(n(bz{3E3M2!e|c82xd zTS>j{m4%{)v~`6?2VW_2BjtvT-Aahlq@D*HD&>e;i40S(u=fk>|F{rTpK~7v{`ulB D2n_Uq diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Settings.class deleted file mode 100644 index 9420861a9951a8429b08d5a232a8ced6cafaf647..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1589 zcmb7ET~8B16g|^jy8VWh0xDmnKy9~$s-Q6ezd{g+1s`fiAn{>aH_O6ym$XxqpTaNj z#RoMK5>52c#2+Qz*|uyYO{8hEGjn_IIrp49yTAW@`vG7b_Z9dUayGY{#l{KOYfXM^ z9$Kbt6uGX|9u#ZNTit3D%R1*2Y$%W!h7Po2t!QbK^r~{8S2;t_GL3z{Mac|ok0Bub zZE6M`^QHfym)glI1fKm-cSOXf78oION9hO3cQY}D8*~yV$u`O<@yQfRtLL~`_=V_q zjPE8U&oTW|9Y3RR;S6)?)Nt!i(Yj7QTYzD2V{G|PR`=(Cm6<4mvPh`Zt~LFBncK*Lr9dsVzgaEu}vjbVcdZ5?IUe`?g;&E maIH(hKpT%fRk+)uc<$4c;*Flg_j)pCt}?&uS-j*@EdK@YgDD;W diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/User.class deleted file mode 100644 index c0cc6c87cded03b76d2e92e8c97e2e1da84a487c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1787 zcmbVLZBNr+6g|(_)-kH!c#$FUDzcT0A}W|*@B@M&E@+s{L_c-VV6p2=+oAp`qlt}) zG5!F5l=0rD1+kQ{_@(#udG0yA_ny;VzrX(ku!#o>QUY_1?{swUqi?o4{;~Dewwy!V zH;vYc-fAD1wx{oTrmG+=FmPlX8@g>!!L#O(x$g_4tOGi)$%~F}+4|nz_Tx2yv}3eP zfkJpAA$8v+YP!pqEyJ<}a_zpD$jYQ?^BT{uu!|SuXl$O(Me-J2L zj@sr*f@B|Bj^(cld@9A;Ki~9!o^(G#w|$ozw5$!%C668qsTjbpKu@XM=!L*_6&YkX zE2>bC`)1p0Bq%?!LKY@mhO% zF^l};V4C*dL%*bg0t-l4ish4$#FLSvqgY_!WF*;SB+)45iD3ZO=vkn*AB5+siuMhI z+CqR4trB2Vs|Fa;is=C3S}_w~LMvtiOld_Wz|0q_PvI6lZG~t@dPQE@eDj)g$+o&obenPneik%Gk>X{=BB?G z@ZzRhJASVb!VX sS?N|*>RvL}c$}+2TrV%+VvjJ_{ba7OIM*xUdVK*GJCC_mq;*#R01lHzzW@LL diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/UserRegistry.class deleted file mode 100644 index 970aced91dfd7f8c243d76c46fae27be61d4a66b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 327 zcmb7*`0ZcK;kr2*pu)Xq|z-=Ga=Cv_)sRHZvQnlSPH(ot?c5_}DAKWHK zN|>zlTB}CO;H+A49SFl~V@TpG*weOs}6)K$ZTqq3`Y zv(U~&|65GMi}3_i{tN1gP&{?**VfrqHCxAJ>pJsR82hRm>+)7LTz4jCHCyZ2xb5;6 zV}yk9Mt52jTHY?Q4d;%~zc<#n2SRUpu_A=C>V*^Za6CYSK4Fv^%k#F(xPI1I!GyE4 z%5|}l<(~hVpE?|JqmH7!!z}{2o%tdr8JZYR^D)`GKQ% ZX#_|l{WWCZL~^h{M^aCP2t&yLqaS1GQQrUn diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/DonationService.class deleted file mode 100644 index 86d299609fbed9ef28c2c620209ae857df2bd9fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 338 zcmb7=u};G<5QhItlLkVe72*ZhfB_33v4B_#Oc4x4-JNiPD~Tf|P9z?S35kIR;Gq!b z!o0Uh7y&vSc68C64+xpCO+zwK*xoVvC(zwMB zr-%u&l^v|9tX{q=R$O|*_(GicOTy^ja7l>g%>!o`VRM26W5P5S$G3f5aC>iyiV3@U zQ`%~2TM7KzjQx{zgwy=rV&{Zx(e!P}HxjsY-vu`=S1ta5@AO(!t@){rBfOJ diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/service/FeedbackService.class deleted file mode 100644 index 4b0e587b06036d7a35cd6fe07ab42099bb8a5b7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 338 zcmb7=u};G<5QhItlLkVeRmBUi0Rt97Vga#Kbc*Ou)ZKAU;5Koj#EHaXF(EPV06Y}p zT$tEc{_}TdTc7Up>-_`3Jtiq4!lm=BQ|*iAs`I_wmexHf&$_x+EjPV2tme$?LYwXK zhf~Ca$wv2Dm0B(@iVYi27~WcE{T*R&dbT3OvwF=L2G}1V!H_V{t>cHTD!6&nMahI| zUK?GmbYlbmHe>&6Tf$ZTZ?PLfwye9x@Z5&)kN=2Y1ZSK;3}pe3O2JGr6;e9}lJht0 by-FiOCK<+%2M3a)-8qqZC`34tj4=KNWkXVR diff --git a/helpmehelpapplication/target/classes/tempClassDiagram.puml b/helpmehelpapplication/target/classes/tempClassDiagram.puml deleted file mode 100644 index c32ad2a..0000000 --- a/helpmehelpapplication/target/classes/tempClassDiagram.puml +++ /dev/null @@ -1,307 +0,0 @@ -@startuml - - - -' ========================= - -' DOMAIN LAYER - -' ========================= - - - -package "Domain Layer" { - - - -class User { - - - idNext : static int - - - id : int - - - name : String - - - email : String - - - passwordHash : String - - - role : String - - - settings : Settings - - - inbox : Inbox - - - - + getUserId() : int - - + setUserId(id : int) - - + getUserName() : String - - + setUserName(name : String) - - + getUserEmail() : String - - + setUserEmail(email : String) - - + getUserPasswordHash() : String - - + setUserPasswordHash(passwordHash : String) - - + getUserRole() : String - - + setUserRole(role : String) - -} - - - -class Settings { - - - lightmode : boolean - - - language : String - - - anonymous : boolean - - - - + getSettings() : String - -} - - - -class Inbox { - - - messages : ArrayList - - - - + getMessages() : ArrayList - - + addMessage(message : Message) - - + removeMessage(message : Message) - -} - - - -class Message { - - - title : String - - - from : Charity - - - date : LocalDateTime - - - - + getTitle() : String - - + getFrom() : Charity - - + getDate() : LocalDateTime - -} - - - -class Charity { - - - idNext : static int - - - id : int - - - name : String - - - description : String - - - totalDonations : double - - - verified : boolean - - - category : String - - - - + getCharityId() : int - - + setCharityId(id : int) - - + getCharityName() : String - - + setCharityName(name : String) - - + getCharityDescription() : String - - + setCharityDescription(description : String) - - + getCharityTotalDonations() : double - - + setCharityTotalDonations(totalDonations : double) - -} - - - -abstract class Donation { - - - idNext : static int - - - id : int - - - amount : double - - - date : LocalDateTime - - - charity : Charity - - - user : User - - - - + getDonationId() : int - - + setDonationId(id : int) - - + getDonationAmount() : double - - + setDonationAmount(amount : double) - - + getDonationDate() : LocalDateTime - - + setDonationDate(date : LocalDateTime) - - + getDonorInfo() : String - -} - - - -class AnonymousDonation { - - - comment : String - -} - - - -class PublicDonation { - - - comment : String - -} - - - -class Feedback { - - - id : int - - - message : String - - - date : LocalDateTime - - - charityId : int - - - - + getId() : int - - + setId(id : int) - - + getMessage() : String - - + setMessage(message : String) - - + getDate() : LocalDateTime - - + setDate(date : LocalDateTime) - -} - - - -class UserRegistry { - - - users : List - - + addUser(user : User) - - + removeUser(user : User) - - + getUserById(id : int) : User - - + getAllUsers() : List - -} - - - -class CharityRegistry { - - - charities : List - - + addCharity(charity : Charity) - - + removeCharity(charity : Charity) - - + getCharityById(id : int) : Charity - - + getAllCharities() : List - -} - - - -class DonationRegistry { - - - donations : List - - + addDonation(donation : Donation) - - + removeDonation(donation : Donation) - - + getDonationById(id : int) : Donation - - + getAllDonations() : List - -} - - - -' Associations - -User "1" -- "0..*" Donation - -Charity "1" -- "0..*" Donation - - - -User "1" -- "0..*" Feedback - -Charity "1" -- "0..*" Feedback - - - -Donation <|-- AnonymousDonation - -Donation <|-- PublicDonation - - - -User "1" *-- "1" Settings - -User "1" *-- "1" Inbox - -Inbox "1" -- "0..*" Message - -Message "1" --> "1" Charity - - - -} \ No newline at end of file From 40c5bedeeb04493bce454cc2172034eba73c1498 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 12:27:52 +0100 Subject: [PATCH 19/25] Fix: Package Placement --- .../java/ntnu/sytemutvikling/team6/Main.java | 8 +- .../sytemutvikling/team6/models/Donation.java | 127 +++++++++--------- .../team6/models/DonationRegistry.java | 47 ++++--- .../sytemutvikling/team6/models/Feedback.java | 110 +++++++-------- .../team6/models/UserRegistry.java | 5 +- .../team6/models/user/Inbox.java | 10 +- .../team6/models/user/Language.java | 2 +- .../team6/models/user/Message.java | 13 +- .../team6/models/user/Settings.java | 26 ++-- .../team6/models/user/User.java | 28 ++-- .../team6/security/PasswordHasher.java | 5 +- .../team6/service/DonationService.java | 4 +- .../team6/service/FeedbackService.java | 4 +- 13 files changed, 176 insertions(+), 213 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/Main.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/Main.java index d265ebe..b30c2e3 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/Main.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/Main.java @@ -1,7 +1,7 @@ package ntnu.sytemutvikling.team6; public class Main { - public static void main(String[] args) { - System.out.println("Hello world!"); - } -} \ No newline at end of file + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java index c72fbee..1fdaa6f 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java @@ -1,81 +1,74 @@ package ntnu.sytemutvikling.team6.models; -import ntnu.sytemutvikling.team6.models.user.User; - import java.time.LocalDateTime; import java.util.UUID; +import ntnu.sytemutvikling.team6.models.user.User; public class Donation { - /* UUID for uniquely identifying each donation */ - private UUID charityId; - - /* Ammount of money donated */ - private double amount; - - /* Date and time of the donation */ - private LocalDateTime date; - - /* The charity that received the donation */ - private Charity charity; - - /* The user/donor that made the donation */ - private User donor; - - /** - * Is the donation made anonymously? - * This can be null if the donation was made anonymously. - * - */ - private boolean isAnonymous; - - /** - * Constructor for creating a new donation. - * The charityId is generated automatically using UUID. - * If the donation is made anonymously, the isAnonymous parameter is set to true. - * @param amount - * @param date - * @param charity - * @param donor - */ - public Donation(double amount, LocalDateTime date, Charity charity, User donor) { - this.charityId = UUID.randomUUID(); - this.amount = amount; - this.date = date; - this.charity = charity; - this.donor = donor; - - - // ASSUMES that this is the way to get the anonymous setting from the user's settings. - if (donor.getSettings().isAnonymous() == false) { - this.isAnonymous = true; - } else { - this.isAnonymous = false; - - } + /* UUID for uniquely identifying each donation */ + private UUID charityId; + + /* Ammount of money donated */ + private double amount; + + /* Date and time of the donation */ + private LocalDateTime date; + + /* The charity that received the donation */ + private Charity charity; + + /* The user/donor that made the donation */ + private User donor; + + /** Is the donation made anonymously? This can be null if the donation was made anonymously. */ + private boolean isAnonymous; + + /** + * Constructor for creating a new donation. The charityId is generated automatically using UUID. + * If the donation is made anonymously, the isAnonymous parameter is set to true. + * + * @param amount + * @param date + * @param charity + * @param donor + */ + public Donation(double amount, LocalDateTime date, Charity charity, User donor) { + this.charityId = UUID.randomUUID(); + this.amount = amount; + this.date = date; + this.charity = charity; + this.donor = donor; + + // ASSUMES that this is the way to get the anonymous setting from the user's settings. + if (donor.getSettings().isAnonymous() == false) { + this.isAnonymous = true; + } else { + this.isAnonymous = false; } + } - /* Getters for the donation's attributes */ - public boolean isAnonymous() { - return isAnonymous; - } + /* Getters for the donation's attributes */ + public boolean isAnonymous() { + return isAnonymous; + } - public UUID getCharityId() { - return charityId; - } + public UUID getCharityId() { + return charityId; + } - public double getAmount() { - return amount; - } + public double getAmount() { + return amount; + } - public LocalDateTime getDate() { - return date; - } + public LocalDateTime getDate() { + return date; + } - public Charity getCharity() { - return charity; - } + public Charity getCharity() { + return charity; + } - public User getDonor() { - return donor; - } + public User getDonor() { + return donor; + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/DonationRegistry.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/DonationRegistry.java index a84ec79..ff6d4e2 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/DonationRegistry.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/DonationRegistry.java @@ -3,37 +3,36 @@ import java.util.*; public class DonationRegistry { - private final List donations; + private final List donations; - public DonationRegistry(){ - this.donations = new ArrayList<>(); - } + public DonationRegistry() { + this.donations = new ArrayList<>(); + } - public List getAllDonations(){ - return Collections.unmodifiableList(donations); - } + public List getAllDonations() { + return Collections.unmodifiableList(donations); + } - public Optional findDonationById(UUID donationId){ - if(donationId == null){ - throw new IllegalArgumentException("DonationId can not be null."); - } - return donations.stream() + public Optional findDonationById(UUID donationId) { + if (donationId == null) { + throw new IllegalArgumentException("DonationId can not be null."); + } + return donations.stream() .filter(donations -> donationId.equals(donations.getCharityId())) .findFirst(); - } + } - public void addDonation(Donation donation){ - if(donation == null){ - throw new IllegalArgumentException("Donation can not be null."); - } - donations.add(donation); + public void addDonation(Donation donation) { + if (donation == null) { + throw new IllegalArgumentException("Donation can not be null."); } + donations.add(donation); + } - public boolean removeDonation(UUID donationId){ - if(donationId == null){ - throw new IllegalArgumentException("DonationId can not be null."); - } - return donations.removeIf(donation -> donationId.equals(donation.getCharityId())); + public boolean removeDonation(UUID donationId) { + if (donationId == null) { + throw new IllegalArgumentException("DonationId can not be null."); } - + return donations.removeIf(donation -> donationId.equals(donation.getCharityId())); + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java index fa3e393..f753e8a 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Feedback.java @@ -1,62 +1,62 @@ package ntnu.sytemutvikling.team6.models; -import ntnu.sytemutvikling.team6.models.user.User; - import java.time.LocalDateTime; import java.util.UUID; +import ntnu.sytemutvikling.team6.models.user.User; public class Feedback { - /* Feedback id */ - private UUID feedbackId; - - /** - * The author of the feedback - * If annonymous the presentation of the user will be "Anonymous". - */ - private User user; - - /* The details of the feedback*/ - private String comment; - - /* The date and time when the feedback was given */ - private LocalDateTime date; - - /* Is the feedback given anonymously? */ - private boolean isAnonymous; - - /** - * Constructor for creating a new feedback. - * - * @param user The user who gives the feedback. - * @param comment The content of the feedback. - */ - public Feedback(User user, String comment) { - this.feedbackId = UUID.randomUUID(); - this.user = user; - this.comment = comment; - this.date = LocalDateTime.now(); - - this.isAnonymous = user.getSettings().isAnonymous(); - } - - /** - * Getters for the feedback's attributes. - * - * @return The feedback's attributes. - */ - public UUID getFeedbackId() { - return feedbackId; - } - public String getComment() { - return comment; - } - public LocalDateTime getDate() { - return date; - } - public User getUser() { - return user; - } - public boolean isAnonymous() { - return isAnonymous; - } + /* Feedback id */ + private UUID feedbackId; + + /** The author of the feedback If annonymous the presentation of the user will be "Anonymous". */ + private User user; + + /* The details of the feedback*/ + private String comment; + + /* The date and time when the feedback was given */ + private LocalDateTime date; + + /* Is the feedback given anonymously? */ + private boolean isAnonymous; + + /** + * Constructor for creating a new feedback. + * + * @param user The user who gives the feedback. + * @param comment The content of the feedback. + */ + public Feedback(User user, String comment) { + this.feedbackId = UUID.randomUUID(); + this.user = user; + this.comment = comment; + this.date = LocalDateTime.now(); + + this.isAnonymous = user.getSettings().isAnonymous(); + } + + /** + * Getters for the feedback's attributes. + * + * @return The feedback's attributes. + */ + public UUID getFeedbackId() { + return feedbackId; + } + + public String getComment() { + return comment; + } + + public LocalDateTime getDate() { + return date; + } + + public User getUser() { + return user; + } + + public boolean isAnonymous() { + return isAnonymous; + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/UserRegistry.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/UserRegistry.java index 7b97e02..c858e31 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/UserRegistry.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/UserRegistry.java @@ -1,6 +1,3 @@ package ntnu.sytemutvikling.team6.models; -public class UserRegistry { - - -} +public class UserRegistry {} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java index 2aa0605..b560092 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Inbox.java @@ -5,17 +5,15 @@ // Enhetstester mangler /** - * Represents a user's inbox that contains messages. - * Provides methods to add, remove and get messages. + * Represents a user's inbox that contains messages. Provides methods to add, remove and get + * messages. * - * @author Robin Strand Prestmo + * @author Robin Strand Prestmo */ public class Inbox { private final List messages; - /** - * Creates an empty inbox with no messages. - */ + /** Creates an empty inbox with no messages. */ public Inbox() { this.messages = new ArrayList<>(); } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java index 0afb14c..ddc5d82 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Language.java @@ -7,4 +7,4 @@ */ public enum Language { ENGLISH -} \ No newline at end of file +} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java index eba920f..ef9707b 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Message.java @@ -8,7 +8,7 @@ /** * Represents a message. * - * @author Robin Strand Prestmo + * @author Robin Strand Prestmo */ public class Message { private final UUID id; @@ -18,18 +18,15 @@ public class Message { private final LocalDateTime timeAndDate; /** - * Creates a message with a unique identifier. - * The message includes a title, a string who it's from, - * content and the time and date. + * Creates a message with a unique identifier. The message includes a title, a string who it's + * from, content and the time and date. * * @param title the title of the message * @param from who the message is from * @param content the content of the message * @throws IllegalArgumentException if title, from or content is null or blank. */ - public Message(String title, - String from, - String content) { + public Message(String title, String from, String content) { if (title == null || title.isBlank()) { throw new IllegalArgumentException("Title cannot be null or blank."); @@ -69,4 +66,4 @@ public String getContent() { public LocalDateTime getTimeAndDate() { return timeAndDate; } -} \ No newline at end of file +} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java index 6bbc685..dd76557 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/Settings.java @@ -12,21 +12,17 @@ public class Settings { private Language language; private boolean anonymous; - /** - * Sets standard settings. - * LightMode enabled, language set to English, - * Anonymous disabled - */ + /** Sets standard settings. LightMode enabled, language set to English, Anonymous disabled */ public Settings() { this(true, Language.ENGLISH, false); } + /** * Creates settings for a user. * * @param lightMode choose between light or dark mode * @param language choose language * @param anonymous choose if user is anonymous - * */ public Settings(boolean lightMode, Language language, boolean anonymous) { if (language == null) { @@ -37,16 +33,12 @@ public Settings(boolean lightMode, Language language, boolean anonymous) { this.anonymous = anonymous; } - /** - * Toggles between light and dark mode - */ + /** Toggles between light and dark mode */ public void toggleLightMode() { lightMode = !lightMode; } - /** - * Toggles anonymous mode on and off - */ + /** Toggles anonymous mode on and off */ public void toggleAnonymousMode() { anonymous = !anonymous; } @@ -56,12 +48,12 @@ public void toggleAnonymousMode() { * * @param newLanguage the language to change to. */ - public void changeLanguage(Language newLanguage) { - if (newLanguage == null) { - throw new IllegalArgumentException("Language cannot be null"); - } + public void changeLanguage(Language newLanguage) { + if (newLanguage == null) { + throw new IllegalArgumentException("Language cannot be null"); + } language = newLanguage; - } + } public boolean isLightMode() { return lightMode; diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java index ba4a298..64594a0 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/user/User.java @@ -6,8 +6,8 @@ /** * Represents a user in the system. * - *

A user has a unique identifier, personal information, a hashed password, a role, - * settings and an inbox. + *

A user has a unique identifier, personal information, a hashed password, a role, settings and + * an inbox. * *

The password is never stored ad plain text. It is hashed using {@link PasswordHasher} * @@ -36,24 +36,16 @@ public class User { * @param inbox the user´s inbox * @throws IllegalArgumentException if any required argument is invalid. */ - public User(UUID id, - String name, - String email, - String password, - Role role, - Settings settings, - Inbox inbox) { - if (id == null) { - throw new IllegalArgumentException("ID cannot be null."); - } + public User( + String name, String email, String password, Role role, Settings settings, Inbox inbox) { if (name == null || name.isBlank()) { throw new IllegalArgumentException("Name cannot be null or blank."); } if (email == null || email.isBlank() || !email.contains("@") || !email.contains(".")) { - throw new IllegalArgumentException("Email cannot be null or blank," - + " and must contain '@' and '.'"); + throw new IllegalArgumentException( + "Email cannot be null or blank," + " and must contain '@' and '.'"); } if (role == null) { @@ -68,7 +60,7 @@ public User(UUID id, throw new IllegalArgumentException("Inbox cannot be null"); } - this.id = id; + this.id = UUID.randomUUID(); this.name = name; this.email = email; this.passwordHash = passwordHasher.getHashPassword(password); @@ -137,8 +129,8 @@ public void setPassword(String password) { */ public void setEmail(String email) { if (email == null || email.isBlank() || !email.contains("@") || !email.contains(".")) { - throw new IllegalArgumentException("Email cannot be null or blank," - + " and must contains '@' and '.'"); + throw new IllegalArgumentException( + "Email cannot be null or blank," + " and must contains '@' and '.'"); } this.email = email; } @@ -154,4 +146,4 @@ public void setEmail(String email) { public boolean checkPassword(String password) { return passwordHasher.isValidPassword(password, passwordHash); } -} \ No newline at end of file +} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java index 60b2876..8c2f7d9 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/security/PasswordHasher.java @@ -9,9 +9,8 @@ /** * A utility for hashing and verifying passwords using PBKDF2. * - *

The generated hash contains both a random salt and the hashed password, - * encoded as Base64 string. - *

+ *

The generated hash contains both a random salt and the hashed password, encoded as Base64 + * string. * * @author Robin Strand Prestmo */ diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/DonationService.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/DonationService.java index ea3b1d7..17692d5 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/DonationService.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/DonationService.java @@ -1,5 +1,3 @@ package ntnu.sytemutvikling.team6.service; -public class DonationService { - -} +public class DonationService {} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/FeedbackService.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/FeedbackService.java index 8aedf7f..27eee23 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/FeedbackService.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/FeedbackService.java @@ -1,5 +1,3 @@ package ntnu.sytemutvikling.team6.service; -public class FeedbackService { - -} +public class FeedbackService {} From 98feae942b5c37f32d23d50ea0361dde1c3cf42f Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 12:28:18 +0100 Subject: [PATCH 20/25] Fix: Package Placement --- .../team6/models/CharityRegistryTest.java | 157 +++++++------ .../team6/models/CharityTest.java | 104 ++++----- .../team6/models/DonationTest.java | 202 ++++++++-------- .../team6/models/FeedbackTest.java | 129 +++++------ .../team6/models/SettingsTest.java | 72 ------ .../team6/models/user/SettingsTest.java | 70 ++++++ .../team6/models/user/UserTest.java | 164 +++++++++++++ .../team6/security/PasswordHasherTest.java | 8 +- .../team6/models/user/UserTest.java | 218 ------------------ .../ntnu/sytemutvikling/team6/Main.class | Bin 568 -> 0 bytes .../team6/models/user/Inbox.class | Bin 2973 -> 0 bytes .../team6/models/user/Language.class | Bin 1146 -> 0 bytes .../team6/models/user/Message.class | Bin 1559 -> 0 bytes .../team6/models/user/Role.class | Bin 1181 -> 0 bytes .../team6/models/user/Settings.class | Bin 1624 -> 0 bytes .../team6/models/user/User.class | Bin 3369 -> 0 bytes .../team6/security/PasswordHasher.class | Bin 2772 -> 0 bytes ...UserTest$constructorTests$emailTests.class | Bin 3560 -> 0 bytes .../user/UserTest$constructorTests.class | Bin 6802 -> 0 bytes .../team6/models/user/UserTest.class | Bin 571 -> 0 bytes ...sswordHasherTest$getHashPasswordTest.class | Bin 2725 -> 0 bytes ...sswordHasherTest$isValidPasswordTest.class | Bin 3211 -> 0 bytes .../team6/security/PasswordHasherTest.class | Bin 772 -> 0 bytes 23 files changed, 519 insertions(+), 605 deletions(-) delete mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/SettingsTest.java create mode 100644 helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java rename helpmehelpapplication/src/test/java/ntnu/{sytemutvikling => systemutvikling}/team6/security/PasswordHasherTest.java (97%) delete mode 100644 helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Inbox.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Language.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Message.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Role.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Settings.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class delete mode 100644 helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/security/PasswordHasher.class delete mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests$emailTests.class delete mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests.class delete mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest.class delete mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest$getHashPasswordTest.class delete mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest$isValidPasswordTest.class delete mode 100644 helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/security/PasswordHasherTest.class diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java index 5176235..232431f 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityRegistryTest.java @@ -1,94 +1,91 @@ package ntnu.systemutvikling.team6.models; -import ntnu.sytemutvikling.team6.models.Charity; -import ntnu.sytemutvikling.team6.models.CharityRegistry; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; import java.util.List; import java.util.Optional; import java.util.UUID; - -import static org.junit.jupiter.api.Assertions.*; +import ntnu.sytemutvikling.team6.models.Charity; +import ntnu.sytemutvikling.team6.models.CharityRegistry; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * UnitTest for CharityRegistry class * * @author Adrian Balunan */ - public class CharityRegistryTest { - private CharityRegistry registry; - private Charity charity; - - /* Setting up variables */ - @BeforeEach - public void setup(){ - registry = new CharityRegistry(); - charity = new Charity("Charity1", "Something Somewhere Somehow", "Cancer"); - } - - - @Test - void testAddCharitySuccessfully() { - registry.addCharity(charity); - - assertEquals(1, registry.getAllCharities().size()); - assertTrue(registry.getAllCharities().contains(charity)); - } - - @Test - void testAddCharityNullThrowsException() { - assertThrows(IllegalArgumentException.class, () -> registry.addCharity(null)); - } - - @Test - void testGetAllCharitiesReturnsUnmodifiableList() { - registry.addCharity(charity); - - List charities = registry.getAllCharities(); - assertThrows(UnsupportedOperationException.class, () -> charities.add(charity)); - } - - @Test - void testFindCharityByIdFound() { - registry.addCharity(charity); - - Optional result = registry.findCharityById(charity.getId()); - - assertTrue(result.isPresent()); - assertEquals(charity, result.get()); - } - - @Test - void testFindCharityByIdNotFound() { - Optional result = registry.findCharityById(UUID.randomUUID()); - assertTrue(result.isEmpty()); - } - - @Test - void testFindCharityByIdNullThrowsException() { - assertThrows(IllegalArgumentException.class, () -> registry.findCharityById(null)); - } - - @Test - void testRemoveCharitySuccessfully() { - registry.addCharity(charity); - - boolean removed = registry.removeCharity(charity.getId()); - - assertTrue(removed); - assertTrue(registry.getAllCharities().isEmpty()); - } - - @Test - void testRemoveCharityNotFound() { - boolean removed = registry.removeCharity(UUID.randomUUID()); - assertFalse(removed); - } - - @Test - void testRemoveCharityNullThrowsException() { - assertThrows(IllegalArgumentException.class, () -> registry.removeCharity(null)); - } + private CharityRegistry registry; + private Charity charity; + + /* Setting up variables */ + @BeforeEach + public void setup() { + registry = new CharityRegistry(); + charity = new Charity("Charity1", "Something Somewhere Somehow", "Cancer"); + } + + @Test + void testAddCharitySuccessfully() { + registry.addCharity(charity); + + assertEquals(1, registry.getAllCharities().size()); + assertTrue(registry.getAllCharities().contains(charity)); + } + + @Test + void testAddCharityNullThrowsException() { + assertThrows(IllegalArgumentException.class, () -> registry.addCharity(null)); + } + + @Test + void testGetAllCharitiesReturnsUnmodifiableList() { + registry.addCharity(charity); + + List charities = registry.getAllCharities(); + assertThrows(UnsupportedOperationException.class, () -> charities.add(charity)); + } + + @Test + void testFindCharityByIdFound() { + registry.addCharity(charity); + + Optional result = registry.findCharityById(charity.getId()); + + assertTrue(result.isPresent()); + assertEquals(charity, result.get()); + } + + @Test + void testFindCharityByIdNotFound() { + Optional result = registry.findCharityById(UUID.randomUUID()); + assertTrue(result.isEmpty()); + } + + @Test + void testFindCharityByIdNullThrowsException() { + assertThrows(IllegalArgumentException.class, () -> registry.findCharityById(null)); + } + + @Test + void testRemoveCharitySuccessfully() { + registry.addCharity(charity); + + boolean removed = registry.removeCharity(charity.getId()); + + assertTrue(removed); + assertTrue(registry.getAllCharities().isEmpty()); + } + + @Test + void testRemoveCharityNotFound() { + boolean removed = registry.removeCharity(UUID.randomUUID()); + assertFalse(removed); + } + + @Test + void testRemoveCharityNullThrowsException() { + assertThrows(IllegalArgumentException.class, () -> registry.removeCharity(null)); + } } diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java index 1707499..5c2f9c2 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/CharityTest.java @@ -1,68 +1,62 @@ package ntnu.systemutvikling.team6.models; +import static org.junit.jupiter.api.Assertions.*; + +import java.util.UUID; import ntnu.sytemutvikling.team6.models.Charity; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.UUID; - -import static org.junit.jupiter.api.Assertions.*; - /** * UnitTesting for Charity. * * @author Adrian Balunan */ public class CharityTest { - private Charity charity; - - @BeforeEach - public void setup(){ - charity = new Charity("Charity1", "Something Somewhere Somehow", "Cancer"); - } - - /** - * Getters should work: - */ - @Test - public void testGettingIdShouldWork(){ - assertInstanceOf(UUID.class, charity.getId()); - } - @Test - public void testGettingCategoryShouldWork(){ - assertEquals("Cancer", charity.getCategory()); - } - @Test - public void testGettingNameShouldWork(){ - assertEquals( "Charity1",charity.getName()); - } - @Test - public void testGettingDescriptionShouldWork(){ - assertEquals("Something Somewhere Somehow",charity.getDescription()); - } - - /** - * Getter and setter for IsVerified should be able to switch between true and false - */ - @Test - public void testIsVerifiedReturnsCorrectly(){ - assertFalse(charity.isVerified()); - charity.setVerified(); - assertTrue(charity.isVerified()); - charity.setUnverified(); - assertFalse(charity.isVerified()); - } - - /** - * totalDonations should display accuratly and adding works - */ - @Test - public void testTotalDonationsReturnsCorrectlyAfterChanges(){ - assertEquals(0, charity.getTotalDonations()); - charity.setTotalDonations(10); - charity.setTotalDonations(5); - assertEquals(15, charity.getTotalDonations()); - } - + private Charity charity; + + @BeforeEach + public void setup() { + charity = new Charity("Charity1", "Something Somewhere Somehow", "Cancer"); + } + + /** Getters should work: */ + @Test + public void testGettingIdShouldWork() { + assertInstanceOf(UUID.class, charity.getId()); + } + + @Test + public void testGettingCategoryShouldWork() { + assertEquals("Cancer", charity.getCategory()); + } + + @Test + public void testGettingNameShouldWork() { + assertEquals("Charity1", charity.getName()); + } + + @Test + public void testGettingDescriptionShouldWork() { + assertEquals("Something Somewhere Somehow", charity.getDescription()); + } + + /** Getter and setter for IsVerified should be able to switch between true and false */ + @Test + public void testIsVerifiedReturnsCorrectly() { + assertFalse(charity.isVerified()); + charity.setVerified(); + assertTrue(charity.isVerified()); + charity.setUnverified(); + assertFalse(charity.isVerified()); + } + + /** totalDonations should display accuratly and adding works */ + @Test + public void testTotalDonationsReturnsCorrectlyAfterChanges() { + assertEquals(0, charity.getTotalDonations()); + charity.setTotalDonations(10); + charity.setTotalDonations(5); + assertEquals(15, charity.getTotalDonations()); + } } diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java index dca66b7..c4851b5 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java @@ -1,115 +1,99 @@ package ntnu.systemutvikling.team6.models; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; import java.time.LocalDateTime; -import java.util.UUID; - -import static org.junit.jupiter.api.Assertions.*; +import ntnu.sytemutvikling.team6.models.Charity; +import ntnu.sytemutvikling.team6.models.Donation; +import ntnu.sytemutvikling.team6.models.user.Inbox; +import ntnu.sytemutvikling.team6.models.user.Role; +import ntnu.sytemutvikling.team6.models.user.Settings; +import ntnu.sytemutvikling.team6.models.user.User; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; class DonationTest { - private Settings settings; - private User user; - private Charity charity; - - // -- Setup -- - @BeforeEach - public void setup(){ - charity = new Charity("name", "something somewhere somehow", "Meow"); - User = new User(); - } - - - // --- Tests --- - @Test - void testDonationInitialization() { - Charity charity = new Charity(); - User user = new User(new UserSettings(true)); - LocalDateTime now = LocalDateTime.now(); - - Donation donation = new Donation(500.0, now, charity, user); - - assertNotNull(donation.getCharityId()); - assertEquals(500.0, donation.getAmount()); - assertEquals(now, donation.getDate()); - assertEquals(charity, donation.getCharity()); - assertEquals(user, donation.getDonor()); - } - - @Test - void testAnonymousFlagWhenUserIsAnonymous() { - User user = new User(new UserSettings(true)); - Charity charity = new Charity(); - Donation donation = new Donation(100, LocalDateTime.now(), charity, user); - - // According to your logic: - // if donor.getSettings().isAnonymous() == false → donation.isAnonymous = true - // else → donation.isAnonymous = false - // - // So if user.isAnonymous() == true → donation.isAnonymous should be false - assertFalse(donation.isAnonymous()); - } - - @Test - void testAnonymousFlagWhenUserIsNotAnonymous() { - User user = new User(new UserSettings(false)); - Charity charity = new Charity(); - Donation donation = new Donation(100, LocalDateTime.now(), charity, user); - - // If user.isAnonymous() == false → donation.isAnonymous = true - assertTrue(donation.isAnonymous()); - } - - @Test - void testCharityIdIsUnique() { - Charity charity = new Charity(); - User user = new User(new UserSettings(true)); - - Donation d1 = new Donation(50, LocalDateTime.now(), charity, user); - Donation d2 = new Donation(75, LocalDateTime.now(), charity, user); - - assertNotEquals(d1.getCharityId(), d2.getCharityId()); - } - - @Test - void testAmountStoredCorrectly() { - Charity charity = new Charity(); - User user = new User(new UserSettings(true)); - - Donation donation = new Donation(123.45, LocalDateTime.now(), charity, user); - - assertEquals(123.45, donation.getAmount()); - } - - @Test - void testDateStoredCorrectly() { - LocalDateTime date = LocalDateTime.of(2024, 5, 10, 12, 30); - Charity charity = new Charity(); - User user = new User(new UserSettings(true)); - - Donation donation = new Donation(200, date, charity, user); - - assertEquals(date, donation.getDate()); - } - - @Test - void testCharityStoredCorrectly() { - Charity charity = new Charity(); - User user = new User(new UserSettings(true)); - - Donation donation = new Donation(200, LocalDateTime.now(), charity, user); - - assertEquals(charity, donation.getCharity()); - } - - @Test - void testDonorStoredCorrectly() { - Charity charity = new Charity(); - User user = new User(new UserSettings(true)); - - Donation donation = new Donation(200, LocalDateTime.now(), charity, user); - - assertEquals(user, donation.getDonor()); - } -} \ No newline at end of file + private Settings settings; + private User user; + private Charity charity; + + // -- Setup -- + @BeforeEach + public void setup() { + charity = new Charity("name", "something somewhere somehow", "Meow"); + user = + new User("Name", "Valid@gmail.com", "123", Role.NORMAL_USER, new Settings(), new Inbox()); + } + + // --- Tests --- + @Test + void testDonationInitialization() { + LocalDateTime now = LocalDateTime.now(); + + Donation donation = new Donation(500.0, now, charity, user); + + assertNotNull(donation.getCharityId()); + assertEquals(500.0, donation.getAmount()); + assertEquals(now, donation.getDate()); + assertEquals(charity, donation.getCharity()); + assertEquals(user, donation.getDonor()); + } + + @Test + void testAnonymousFlagWhenUserIsAnonymous() { + Donation donation = new Donation(100, LocalDateTime.now(), charity, user); + + // According to your logic: + // if donor.getSettings().isAnonymous() == false → donation.isAnonymous = true + // else → donation.isAnonymous = false + // + // So if user.isAnonymous() == true → donation.isAnonymous should be false + assertFalse(donation.isAnonymous()); + } + + @Test + void testAnonymousFlagWhenUserIsNotAnonymous() { + Donation donation = new Donation(100, LocalDateTime.now(), charity, user); + + // If user.isAnonymous() == false → donation.isAnonymous = true + assertTrue(donation.isAnonymous()); + } + + @Test + void testCharityIdIsUnique() { + Donation d1 = new Donation(50, LocalDateTime.now(), charity, user); + Donation d2 = new Donation(75, LocalDateTime.now(), charity, user); + + assertNotEquals(d1.getCharityId(), d2.getCharityId()); + } + + @Test + void testAmountStoredCorrectly() { + Donation donation = new Donation(123.45, LocalDateTime.now(), charity, user); + + assertEquals(123.45, donation.getAmount()); + } + + @Test + void testDateStoredCorrectly() { + LocalDateTime date = LocalDateTime.of(2024, 5, 10, 12, 30); + + Donation donation = new Donation(200, date, charity, user); + + assertEquals(date, donation.getDate()); + } + + @Test + void testCharityStoredCorrectly() { + Donation donation = new Donation(200, LocalDateTime.now(), charity, user); + + assertEquals(charity, donation.getCharity()); + } + + @Test + void testDonorStoredCorrectly() { + Donation donation = new Donation(200, LocalDateTime.now(), charity, user); + + assertEquals(user, donation.getDonor()); + } +} diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java index f3e3e8d..b21def7 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java @@ -1,91 +1,86 @@ package ntnu.systemutvikling.team6.models; -import ntnu.sytemutvikling.team6.models.Settings; -import ntnu.sytemutvikling.team6.models.User; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; import java.time.LocalDateTime; -import java.util.UUID; - -import static org.junit.jupiter.api.Assertions.*; +import ntnu.sytemutvikling.team6.models.Feedback; +import ntnu.sytemutvikling.team6.models.user.Inbox; +import ntnu.sytemutvikling.team6.models.user.Role; +import ntnu.sytemutvikling.team6.models.user.Settings; +import ntnu.sytemutvikling.team6.models.user.User; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; class FeedbackTest { - private User user; - private Settings settings; - - // -- Setup -- - @BeforeEach - public void setup() { - settings = new Settings(true); // default anonymous = true - user = new User(); - } - - // --- Tests --- + private User user; + private Settings settings; - @Test - void testFeedbackInitialization() { - LocalDateTime before = LocalDateTime.now(); - Feedback feedback = new Feedback(user, "Nice work!"); - LocalDateTime after = LocalDateTime.now(); + // -- Setup -- + @BeforeEach + public void setup() { + settings = new Settings(); // default anonymous = true + user = + new User("Name", "Valid@gmail.com", "123", Role.NORMAL_USER, new Settings(), new Inbox()); + } - assertNotNull(feedback.getFeedbackId()); - assertEquals("Nice work!", feedback.getComment()); - assertEquals(user, feedback.getUser()); + // --- Tests --- - // Date should be between before and after - assertTrue(!feedback.getDate().isBefore(before) && !feedback.getDate().isAfter(after)); - } + @Test + void testFeedbackInitialization() { + LocalDateTime before = LocalDateTime.now(); + Feedback feedback = new Feedback(user, "Nice work!"); + LocalDateTime after = LocalDateTime.now(); - @Test - void testAnonymousFlagWhenUserIsAnonymous() { - // user.settings.isAnonymous() == true → feedback.isAnonymous = false - settings = new UserSettings(true); - user = new User(settings); + assertNotNull(feedback.getFeedbackId()); + assertEquals("Nice work!", feedback.getComment()); + assertEquals(user, feedback.getUser()); - Feedback feedback = new Feedback(user, "Anonymous feedback"); + // Date should be between before and after + assertTrue(!feedback.getDate().isBefore(before) && !feedback.getDate().isAfter(after)); + } - assertFalse(feedback.isAnonymous()); - } + @Test + void testAnonymousFlagWhenUserIsAnonymous() { + // user.settings.isAnonymous() == true → feedback.isAnonymous = false + Feedback feedback = new Feedback(user, "Anonymous feedback"); - @Test - void testAnonymousFlagWhenUserIsNotAnonymous() { - // user.settings.isAnonymous() == false → feedback.isAnonymous = true - settings = new UserSettings(false); - user = new User(settings); + assertFalse(feedback.isAnonymous()); + } - Feedback feedback = new Feedback(user, "Not anonymous"); + @Test + void testAnonymousFlagWhenUserIsNotAnonymous() { + Feedback feedback = new Feedback(user, "Not anonymous"); - assertTrue(feedback.isAnonymous()); - } + assertTrue(feedback.isAnonymous()); + } - @Test - void testFeedbackIdIsUnique() { - Feedback f1 = new Feedback(user, "First"); - Feedback f2 = new Feedback(user, "Second"); + @Test + void testFeedbackIdIsUnique() { + Feedback f1 = new Feedback(user, "First"); + Feedback f2 = new Feedback(user, "Second"); - assertNotEquals(f1.getFeedbackId(), f2.getFeedbackId()); - } + assertNotEquals(f1.getFeedbackId(), f2.getFeedbackId()); + } - @Test - void testCommentStoredCorrectly() { - Feedback feedback = new Feedback(user, "This is a test comment"); + @Test + void testCommentStoredCorrectly() { + Feedback feedback = new Feedback(user, "This is a test comment"); - assertEquals("This is a test comment", feedback.getComment()); - } + assertEquals("This is a test comment", feedback.getComment()); + } - @Test - void testUserStoredCorrectly() { - Feedback feedback = new Feedback(user, "Hello"); + @Test + void testUserStoredCorrectly() { + Feedback feedback = new Feedback(user, "Hello"); - assertEquals(user, feedback.getUser()); - } + assertEquals(user, feedback.getUser()); + } - @Test - void testDateIsSet() { - Feedback feedback = new Feedback(user, "Testing date"); + @Test + void testDateIsSet() { + Feedback feedback = new Feedback(user, "Testing date"); - assertNotNull(feedback.getDate()); - } -} \ No newline at end of file + assertNotNull(feedback.getDate()); + } +} diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java deleted file mode 100644 index 3221be5..0000000 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/SettingsTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package ntnu.systemutvikling.team6.models; - -import ntnu.sytemutvikling.team6.models.Language; -import ntnu.sytemutvikling.team6.models.Settings; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.*; - -class SettingsTest { - - @Test - void testDefaultConstructorSetsStandardValues() { - Settings settings = new Settings(); - - assertTrue(settings.isLightMode()); - assertEquals(Language.ENGLISH, settings.getLanguage()); - assertFalse(settings.isAnonymous()); - } - - @Test - void testCustomConstructorSetsValuesCorrectly() { - Settings settings = new Settings(false, Language.ENGLISH, true); - - assertFalse(settings.isLightMode()); - assertEquals(Language.ENGLISH, settings.getLanguage()); - assertTrue(settings.isAnonymous()); - } - - @Test - void testConstructorThrowsExceptionWhenLanguageIsNull() { - assertThrows(IllegalArgumentException.class, - () -> new Settings(true, null, false)); - } - - @Test - void testToggleLightMode() { - Settings settings = new Settings(true, Language.ENGLISH, false); - - settings.toggleLightMode(); - assertFalse(settings.isLightMode()); - - settings.toggleLightMode(); - assertTrue(settings.isLightMode()); - } - - @Test - void testToggleAnonymousMode() { - Settings settings = new Settings(true, Language.ENGLISH, false); - - settings.toggleAnonymousMode(); - assertTrue(settings.isAnonymous()); - - settings.toggleAnonymousMode(); - assertFalse(settings.isAnonymous()); - } - - @Test - void testChangeLanguageSuccessfully() { - Settings settings = new Settings(); - - settings.changeLanguage(Language.ENGLISH); - assertEquals(Language.ENGLISH, settings.getLanguage()); - } - - @Test - void testChangeLanguageThrowsExceptionWhenNull() { - Settings settings = new Settings(); - - assertThrows(IllegalArgumentException.class, - () -> settings.changeLanguage(null)); - } -} \ No newline at end of file diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/SettingsTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/SettingsTest.java new file mode 100644 index 0000000..18b2814 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/SettingsTest.java @@ -0,0 +1,70 @@ +package ntnu.systemutvikling.team6.models.user; + +import static org.junit.jupiter.api.Assertions.*; + +import ntnu.sytemutvikling.team6.models.user.Language; +import ntnu.sytemutvikling.team6.models.user.Settings; +import org.junit.jupiter.api.Test; + +class SettingsTest { + + @Test + void testDefaultConstructorSetsStandardValues() { + Settings settings = new Settings(); + + assertTrue(settings.isLightMode()); + assertEquals(Language.ENGLISH, settings.getLanguage()); + assertFalse(settings.isAnonymous()); + } + + @Test + void testCustomConstructorSetsValuesCorrectly() { + Settings settings = new Settings(false, Language.ENGLISH, true); + + assertFalse(settings.isLightMode()); + assertEquals(Language.ENGLISH, settings.getLanguage()); + assertTrue(settings.isAnonymous()); + } + + @Test + void testConstructorThrowsExceptionWhenLanguageIsNull() { + assertThrows(IllegalArgumentException.class, () -> new Settings(true, null, false)); + } + + @Test + void testToggleLightMode() { + Settings settings = new Settings(true, Language.ENGLISH, false); + + settings.toggleLightMode(); + assertFalse(settings.isLightMode()); + + settings.toggleLightMode(); + assertTrue(settings.isLightMode()); + } + + @Test + void testToggleAnonymousMode() { + Settings settings = new Settings(true, Language.ENGLISH, false); + + settings.toggleAnonymousMode(); + assertTrue(settings.isAnonymous()); + + settings.toggleAnonymousMode(); + assertFalse(settings.isAnonymous()); + } + + @Test + void testChangeLanguageSuccessfully() { + Settings settings = new Settings(); + + settings.changeLanguage(Language.ENGLISH); + assertEquals(Language.ENGLISH, settings.getLanguage()); + } + + @Test + void testChangeLanguageThrowsExceptionWhenNull() { + Settings settings = new Settings(); + + assertThrows(IllegalArgumentException.class, () -> settings.changeLanguage(null)); + } +} diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java new file mode 100644 index 0000000..7bd0ff4 --- /dev/null +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java @@ -0,0 +1,164 @@ +package ntnu.systemutvikling.team6.models.user; + +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.UUID; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class UserTest { + + @Nested + class constructorTests { + private final UUID validID = UUID.randomUUID(); + private final String validName = "Name"; + private final String validEmail = "Email@gmail.com"; + private final String validPassword = "Password"; + private final Role validRole = Role.NORMAL_USER; + private final Settings validSettings = new Settings(); + private final Inbox validInbox = new Inbox(); + + @Test + void shouldThrowIfIdIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + null, + validName, + validEmail, + validPassword, + validRole, + validSettings, + validInbox)); + } + + @Test + void shouldThrowIfNameIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, null, validEmail, validPassword, validRole, validSettings, validInbox)); + } + + @Test + void shouldThrowIfNameIsBlank() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, " ", validEmail, validPassword, validRole, validSettings, validInbox)); + } + + @Nested + class emailTests { + + @Test + void shouldThrowIfEmailIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, validName, null, validPassword, validRole, validSettings, validInbox)); + } + + @Test + void shouldThrowIfEmailIsBlank() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, validName, " ", validPassword, validRole, validSettings, validInbox)); + } + + @Test + void shouldThrowIfEmailDoesNotContainAt() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, + validName, + "test.gmail.com", + validPassword, + validRole, + validSettings, + validInbox)); + } + + @Test + void shouldThrowIfEmailDoesNotContainPeriod() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, + validName, + "test@gmailcom", + validPassword, + validRole, + validSettings, + validInbox)); + } + } + + @Test + void shouldThrowIfPasswordIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User(validID, validName, validEmail, null, validRole, validSettings, validInbox)); + } + + @Test + void shouldThrowIfRoleIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, validName, validEmail, validPassword, null, validSettings, validInbox)); + } + + @Test + void shouldThrowIfPasswordIsBlank() { + assertThrows( + IllegalArgumentException.class, + () -> + new User(validID, validName, validEmail, " ", validRole, validSettings, validInbox)); + } + + @Test + void shouldThrowIfSettingsIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User(validID, validName, validEmail, validPassword, validRole, null, validInbox)); + } + + @Test + void shouldThrowIfInboxIsNull() { + assertThrows( + IllegalArgumentException.class, + () -> + new User( + validID, validName, validEmail, validPassword, validRole, validSettings, null)); + } + + @Test + void shouldCreateUser() { + User user = + new User( + validID, validName, validEmail, validPassword, validRole, validSettings, validInbox); + + assertAll( + () -> assertEquals(validID, user.getId()), + () -> assertEquals(validName, user.getName()), + () -> assertEquals(validEmail, user.getEmail()), + () -> assertEquals(validRole, user.getRole()), + () -> assertEquals(validSettings, user.getSettings()), + () -> assertEquals(validInbox, user.getInbox())); + } + } +} diff --git a/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java similarity index 97% rename from helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java rename to helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java index 68a9409..dada18f 100644 --- a/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/security/PasswordHasherTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java @@ -1,10 +1,10 @@ -package ntnu.sytemutvikling.team6.security; +package ntnu.systemutvikling.team6.security; + +import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; - class PasswordHasherTest { private final PasswordHasher hasher = new PasswordHasher(); @@ -67,4 +67,4 @@ void shouldThrowIfStoredHashIsBlank() { assertThrows(RuntimeException.class, () -> hasher.isValidPassword("Password", " ")); } } -} \ No newline at end of file +} diff --git a/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java b/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java deleted file mode 100644 index 5fa92c8..0000000 --- a/helpmehelpapplication/src/test/java/ntnu/sytemutvikling/team6/models/user/UserTest.java +++ /dev/null @@ -1,218 +0,0 @@ -package ntnu.sytemutvikling.team6.models.user; - -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -import java.util.UUID; - -import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.assertEquals; - -class UserTest { - - @Nested - class constructorTests { - private final UUID validID = UUID.randomUUID(); - private final String validName = "Name"; - private final String validEmail = "Email@gmail.com"; - private final String validPassword = "Password"; - private final Role validRole = Role.NORMAL_USER; - private final Settings validSettings = new Settings(); - private final Inbox validInbox = new Inbox(); - - @Test - void shouldThrowIfIdIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - null, - validName, - validEmail, - validPassword, - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfNameIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - null, - validEmail, - validPassword, - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfNameIsBlank() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - " ", - validEmail, - validPassword, - validRole, - validSettings, - validInbox - )); - } - - @Nested - class emailTests { - - @Test - void shouldThrowIfEmailIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - null, - validPassword, - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfEmailIsBlank() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - " ", - validPassword, - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfEmailDoesNotContainAt() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - "test.gmail.com", - validPassword, - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfEmailDoesNotContainPeriod() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - "test@gmailcom", - validPassword, - validRole, - validSettings, - validInbox - )); - } - } - - @Test - void shouldThrowIfPasswordIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - validEmail, - null, - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfRoleIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - validEmail, - validPassword, - null, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfPasswordIsBlank() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - validEmail, - " ", - validRole, - validSettings, - validInbox - )); - } - - @Test - void shouldThrowIfSettingsIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - validEmail, - validPassword, - validRole, - null, - validInbox - )); - } - - @Test - void shouldThrowIfInboxIsNull() { - assertThrows(IllegalArgumentException.class, () -> - new User( - validID, - validName, - validEmail, - validPassword, - validRole, - validSettings, - null - )); - } - - @Test - void shouldCreateUser() { - User user = new User( - validID, - validName, - validEmail, - validPassword, - validRole, - validSettings, - validInbox - ); - - assertAll( - () -> assertEquals(validID, user.getId()), - () -> assertEquals(validName, user.getName()), - () -> assertEquals(validEmail, user.getEmail()), - () -> assertEquals(validRole, user.getRole()), - () -> assertEquals(validSettings, user.getSettings()), - () -> assertEquals(validInbox, user.getInbox()) - ); - } - - } -} \ No newline at end of file diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/Main.class deleted file mode 100644 index 110f8b9c4ad1592f72a4edc10270d108662df524..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 568 zcmaKqO;5r=5Qg97tF%@@5d22)1Rm^74;U{-Z03Duo}KLUwg{v5`fNp*Z3b?noXCovYr+>nn!bkqCr3 zW=J<%T@!hj1}qy3u>X{Ireo##R29b5RB;oK2%YOl1gfJVkNfRBmKf}FPs*_V7)El? zuu#OZfs&0fRv5~2x)_WH&5!|Mn=@`QAVEbiY`3}wstmP21+g=p(h#wlh##nRGwoqSe-DA`ret)gP3~IefEYv*JmEpyYf+|iO4H9fW)W!Za9o?*VYrftiVQ|G1VfYAB<CsIf&7}qd?w-_#;3Tfh^y|3zqD{O{4QHtjvMhTlRe6A@C z8Qfw>RCTkmq}x*TKvRw@zQf$e#xYHEp~)>4OaI>0@E&HU7N@sWag4GYLIOrEdALoE!KYQoKv@MKf= z{+_ASj!OzY)^J}Y7^x09O?x38d)%NZPZaf<$z9JD4D&6;JX^SspzK_hswhXz$k0>J zP4U31mxR44`-emptTH#&x$XB;IN0uP>m*|GoJ4+e6GGjR%rk-h!M&*&Q^=G}^d<6M13|&Q+mv@)>Ug*Texo}@52bGGuQ8Lr1 zb6Oon&_TnXgsCuOE*MRD2K~?w(04Y^E$UH&*Gm;X*0gwxntb8R@(U_R6Z&9?-m;kz zUoBdmT^38aEK$|3uPJ$e(Vi_>mP@A(-&+>$wpDR@G1Jq5no8Hw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1u$L*?R#T_@EmkF~fqKHYJR~UK{ z8)r%V((}o^2znR>*IcK3VUh@X8R9v|7F7PiC>4F^S1_RAItCdod9|v-wDjHG^%Vxy zHSD5O_AjwS(kJsbV7?v0h$|S;Fp3)t8C%#@z4Auza#b9ghZZTN3vQHW^s-arRz%BjBCh9hf?r6SD|A< z!K8*em}2Pl8Wd)k>l;qNuvQGgcj!h#w4GNB1E(!Ehj_i-)i8s53?1_Ql3kQ|hCZKM z0ES^UV1UiNG<%YJ)K!i|W9Zy4ZT_@c&U1Ii$opzY@_UAB%6r`z5--gPgTC=!LzriX zZVRJuxM>{K6NO7$tkYm3WW7yg=swlO`(o;QNGel=+(KFuI@Onr*2n`k2&8U1Rky&` zOi5m=k3TDCfe{*73w@$t#N-aqDJCcHSsJZpX`-Gb>B+W%)&lqGIZL;nXhn#ukvaiO ze}|g>2<0uJUl84ob)Mkzw{dcgH#obcGegcygY&9%ras|X4MVAP4P&YC8WO2Y4QcXb zYnXmdMOraO&l&nYfjE^NMJG}2Bf?`uF-yBRi!^d{dO~}*g$e9n68p4!&oPC0LZy7N zSil3i5pAzo=AC4_QVK(^Fx6V5b3fXCQ<0E@VFeNY545ZFBLN;_ur7m6R%QvOK49n_ z9a=o9QY%SVme%}$dTEA7SR#+qun|0V9y}KaUJe8&&Vv^N!MQ+i`aF0!5WGT4Hq)Ly N4_*rduX@U?{Q;9ILF@nk diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Role.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/Role.class deleted file mode 100644 index 8d6c32ea9233165043bdc30cdfd4f45d6854a2b2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1181 zcmb7DZBNrs6n^g7u4^f5OhlRZ!i&0&mpb3Rj1U$w1IYlh!ji=grW;o%c3sl7B!2TJ z=}3fVG<^0)8PDxzoIw+}q&+?Np69veJonl6AD_PgsNji;1Vh0O{mAOR3wb*VPu;hk z>mO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fr4~>ChZ+RUkQ%2oh*3hw&IAc;YdRdCg5;Seqol{e&zf2Ehhtxrls=O3u=_KIz*hS_Hfn n%6MR-LqT5)kA5=lbxEH7d?|UWYw}W8=G0~87hRK=J&Kiod>1+S diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/user/User.class deleted file mode 100644 index e981ecb29753f548c70640e8cfa7b8d65e4f2e66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3369 zcmb7G-E$LF6#v~e?WW1L#X!N*Rs$$$zM2AxU<$U-Vxy%Xp%E%5n`CXb-E2yBQ(&BN zeDTFUKnKPrpJc`dzfxvoM&EG8NBHia^#sjq3~TxG3V z(k*AQv4;M7cDm&r49=58cITe5cm3<8gj7%;y4P~8*VXdX3xd4W- zPr*wnLfF46AXh{{G3*Nz;iime)sGQ@iDj*%xA_W}E8#rLP5E(1K+Lk`Q5AQ+HdN6GjEX_A3g1=0&8%`l(mBoWrEVz^Ybop9ZBI5HcN zhmom>A4dfCUn`sKLHcn_;80d~9LnBqGw#Rh0tYfyzI?y!%K##nR1j4WLtG$cIaW1g zKXCL?)!8;SO){2pbggtcRVo*C(@s@wy^>m?hd_@}Bv@VOtBzr&R#r0eX||YDF@=sd6f3!vcSv> zQrT|hG8gEIimUj5kT&d`W*WsN(vc2G?*%%#%2s*>{;rERiMUs|tCQ!`WKS`=#H#^% zm+~&Y(Ht@4A~hX>vt(HMas~EhmANrhigT_#|eBvff6N@~0 z3Jhi)t+07n+mZ$q+@emDgS7#wf{(i%63kZxcLb)ogVcjbL0%x$1WXAk^pU4JO+fFnyq4bs$@=RtowhgE1Lk z%1kjMaD?Vq4_*9zx&>)u(<;O_2)%oF^vgF5clo9%D8JLtlW!Vc@=e2s-YTem$kOvV zAihB_*#sWPos|*Z)5Qqj>i%;Bx1=Lrei&2pK`A5&kZDZd1Yc{ICyZ*ckpT3|!>cl2t||%C0~XNnDVn>I1KDlJ-vk$k<{7)Z5 z-5@G0w$+AhRnm_svemG7uWm6(NsMz6)Ua`{VdJ|RcFF6(>Grg$)KA;gPxqZ!6;I!^im@f5Zy|g$h;_kT}EdS6*%cbw&VE}?papvX| TT>Ay5IAGDz3&XT?q=V{z(EAya diff --git a/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/security/PasswordHasher.class b/helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/security/PasswordHasher.class deleted file mode 100644 index e454773c8dd1e84d32bd2397f0695b732674173c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2772 zcmb7`*Xqe#4gr)mxm;az| zed~)4T|OV6#ZP_fL;s<^wf)`6LQs6@2R<`r=AL`*Io~-;{`%+lKLGUNyD)0t)8N+; zKu{q1$XGIxIm5~%Z_hrGX;&b4-Ly=%Q^42II2lF=wHm@YBG9*~kGr;MWdtZV4PMo>9>nSL$-iu;%g$9bwetn1Srl8cxx^+Ov{O+pCLiKItsVbaFJ+J1AGjDJs}! zbezRGfry*$&Kh=?Z5yis{)WbxZXd+cAHq0^CPm~t&uEzGo=FW1C<@I2`$kiPJ$;w& znQpd!!AOtycU`{P7Df^mHC)nh8La~K+s*0*U^SzaLFo_(?wTpA{)ezhG88exGiwV%c~s} z2~>K~P2|hfcR;09m4~Ie&~Qg!uV=@r?MmHg7%wNTw=h<)TysHI) zC7K6#sNp>w24;6cQ!x{q^9(XOsy|}6Ps}hA<{&l9>&PH0aKwXC$-`mkI7UYHm>KD? z2ePU4J}DSEN(4;A(;++(NK}JaGIHje;l9MC9zLdCH$xNHJ!D#Pq_8k6?FmIeAU2dw z8@WltHq~?KrQgk(>=La*|GR5-@C>HBYGLJeCUADA_^Uoj2?@P)j2vUFnMo;`{YT)K zr&lTNm--Wr)8@;a;`nyeSNZ^Ls?=eDsavTN3NqMV&x;_1 zC_Ss^uZCmTj}u%y!>6-2jYeEU6FPAoLug?uN#Z^(B8yh;Z=;1PDBvnSrIw2RK1X{! zCg5Mvu3D2Hfym8(J8I*#`#Y1E0}1ANFGq*EfNq>u2i=jkJSLaBzQ zfS&mywg0ls@K@164I%zRXc&!9^E2)#vc5t4wbXXDSOG|89%ODQ5VtufM{yH(I7ue>cNY(Fk2|Lbc-jLxk1+MeJWxJwmqP33z7`K{fVrZ(#0Yo-YKedj> lzv6((eNmPBd#Umj-__tLzUDnfX^<1-8-9fcynl<@{{WZ#th@jK diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests$emailTests.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests$emailTests.class deleted file mode 100644 index 51a8c3c7dae55e114272893cb6e906b851d467b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3560 zcmbtWYgZFT7=DJ^hPX(K)`GPbX|xcO#a`?swi<2{8zUtN*4o-`k^vSrJ7ISg#ZUc9 zJ;xqBdQN{pPe1hs_4J+HK!TF696n@c-pM=9^Uiyl`TM`ue*sv)a}7NVw;k#DhPNwu z-IqJomTfufhU8}brcoC)ZhMCBan~r*r^G#(stU)Gu3wcRki9ti(63=YhlUu#nN4%Y zG<<2<#)HZxuS$>Mw9B`B%jE^(6nxuexH^#!)NGTuLbc4~yGw(JW z%enbX3{wn!1+&g$xXv&nDTnT?t8A)@dJG0bY?+SpRJb*Tctgjh_>5sNKwJ?v#qCCELozR_roC#qmXe!`eX2t-$EbF;Zg^u z7s%YAapdaec;-&oE@>njeHP0A~V-a^`_WmI7NxslKyGG zHJY13+m=kHW^*r<7h=nAbZ6g;$=Q0QXxL%6(n`()h8{e=2I}aSx~tMdB=i-=C`buDWuT#P`QczJ*_D2JdMEp4xpD0 z2Q3lUlOsV39YDtq2dxmOeI)3E4xk?&4%#5l=iNaQJ*vin`(Od2ZHP);1wdH^6pM{`xs=^Bgm+;bSKLm zgRFc688x*gS*hv9^Z_@rV{qMV<4V8nMfBq#d9(*VVlR&$k^EDz_87m=m?nR3QSm*& juk;INmHiptpKZ|0CH)Je%kUT;&EqtaH2QdoU5x$@t(>{* diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest$constructorTests.class deleted file mode 100644 index e7def3c7dea39376de39934c3b6c605f9dc1b659..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6802 zcmbtY`F|8=8UId5vdLxwVS%=xNNC+cvT0e4g4RVKq(M?cKo)|CS|__hSeV@jyR#f# z#iP}##kSQZts8QMoV8KGoZh~%DCS~b1YIiT zBSx)NOZMy;zFtAJs1>qi-eF?Bu0q>X`Ic(OLM)2l5*3%?G6kCoR-v3Mov`$L**cm# zY~*OHrEB^1$-J4>jZ(5)(u>JGeC*asRy<=CN>;I)u}quix+6z5BbOD`UC!dFy4tW< zLG!4V*G20R6)(V21?~0(`Klo1+mEzWr1Df7mMNGwl-F{`<_USO%$RwZf2E2S%KWH3 z-xg@YRSMd6YNgUKvzQg36)Ji~sM8jzjwH|@!PP3R!Ab>*aEsn$8Z@zEbjPmk10y%? zNe}H(aP>&|x%OVKQn6ZeI;$4Q2-YfC84f0`TNXE^6vY~}%lg)bJ$Id_cjKRZkx_41Gc~28t8q zyk4+|j%V~qD`ysBjJ`n?*JFr&rXSZcWs4_L=nbi?uGcaS&EiDzP?>SX=VZ>Jk86{; z2F|uiYA{aC{ zn7Rn{{*+-O+D65oU@*q4#K#@lY0{o;DBR&eL@ces$o$~jz=bH>n) z{V_!4(IF329-Y`PUYk*o1p}tt@y7wFO3B{+7vp@aH)%|$IEWlG?SyW*@t$O533s;6 z{);(>RT#*7;W2citQicC75?yW%4y2yTkaRBd}){}CUJyGnU+)>LBX2P##H7osM9E^ zuux`ZA()fvSB3_%Jyt-DsW^@k&feHHNx{NO)wL_XTh>JO4JzI!vZ7GxpL~0>ikqa6 zx5(aR+wc|z3JYN8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mjpYpLJ#)kUdK14 zZ9PujUE=PF-y_&3&5o|P@lk_*-z@0t$z1ed*Y=(nwx1-hKLBeK-0f4)6JS1Dz{ci_ z>6P%VK|kd~5852In=bk`*Zie^^98%1^(TG!O9QNDb6algdbYqp>NhklX1-h?lCx$(>7zhZy8ACd!4v1j=W zbL?r>m(wowphtbfqrT};-}0#Mc+{gF^+S*Pu}A&Xqn`4pXFTdTkNPF4Khvhgv}Ymi T$6rYQmDJz){s;br|DgN-7mm4y diff --git a/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest.class b/helpmehelpapplication/target/test-classes/ntnu/sytemutvikling/team6/models/user/UserTest.class deleted file mode 100644 index 810d4b9c1a1ad74452dac74f086ad3201173e017..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 571 zcmbtRyG{c!5F95V2YHZ?@G2=%00pL^0YMRg1PY-5(mRI*4nCiB_C?~esE{c506q#a z7eGjK5w^TLJ6_Ftz3(5dZvalQSwjis2$cpFP!(uT)Kp2U+`YUSPjnmvsz=6|a4b;X z-Wf$$6xegY<O=OD5j?AeX$oTkR?Z25qRrg z>N#n{$wPlYPk&QSW+fR50<`d8X=iumo69#d*5CiW`wPH4*5hbHyM_)Oo#q*1RzF6N973nhcIO3IOIHG7xzo!7;-PW%w6}j?Nk@JTNBQzaAjswNF_B-)E+~ZtQl_R zHp6t`T&TG?deEyOsiO}mhUC$B$iySVGUOA6_VJ0bhL0Gowl3vOQ*3f`#@Y1h!jkj5 z715A}ZKWuwgE}taV+Kv^Qdm+j?2ez$%j06FMBC10cFQB@=-Du&aI(B%WH&skqFl(% z`)2vNDJaTejA$6uaS3A#>EktLTvs?smAKZ401{Sfj{Ta%Qk3aAlMZudFdwZ6AJKOz z1%|)@j~IH7 z)asE=DM^P){!picTZ*Twj@!6HAOQnKTh71oxJe}3h>{R=W$wdnn<&R{kAbBbzBp&S z+?08Dg#T=P37dQZA(`=yb%!SCXwpx#EUrn5iIL?=1VI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BZr3^)i)V`u$;Kc`WPJ5hp8#(U~=Uw8Q zX@fJ{n)6<8pR+AEXNhx;I3KjZ`Lf2j?Q1(+l{3i6T2MYA%6WPLSqM-L*QAX$m3F;G znWAGAUg(QGn0k*#z$q5C>Pm{YVPKIw_RNKsy;2Y=LAwSEmD*Q9seIX&KR+m1Um~J(LeE5!FNCixdfFK_c`x>Y!um3OlogKdXlj3i<*4 zsOXLr6!>B|FX% zml&+Q{f3P=!=bPJ&{ZQX`k@}m2TxMF7QBDrD$xo9sYmWDSL$&Pw6D18iXaIaRstzF zHs&2HAkA<*vr1hkGf#IS$#7JiS>cQ!S{}3oL%J$`Q49M`5!89pBPLrNw7A#cfi(3u z8P#2>7*1!mGQ*Nx@@^0YEpaK0MgH$rOv`~;I76yN_*$58l#Mlp%FK5&YP(W3xF_2` zK8CZg{%^UC(B=Vu%P}|=-xopIqZbymo7@ynVyFCy9ZEoia!1QH8JHlL;1QFdssxJ= zkSUJAim$Nm$4ERQ`9xdPHSsR9RT2GlCW5=^G=oiUKwWXD2v? LO~M75Vhi{LR*u_M From 6c3f7ebd4f337a5544c4801163f5a8e5687971a7 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 12:34:41 +0100 Subject: [PATCH 21/25] Fix: Fixed tests based on User being able to create their own id on creation --- .../team6/models/user/UserTest.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java index 7bd0ff4..d12331f 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java @@ -4,6 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.UUID; + +import ntnu.sytemutvikling.team6.models.user.Inbox; +import ntnu.sytemutvikling.team6.models.user.Role; +import ntnu.sytemutvikling.team6.models.user.Settings; +import ntnu.sytemutvikling.team6.models.user.User; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -25,7 +30,6 @@ void shouldThrowIfIdIsNull() { IllegalArgumentException.class, () -> new User( - null, validName, validEmail, validPassword, @@ -40,7 +44,7 @@ void shouldThrowIfNameIsNull() { IllegalArgumentException.class, () -> new User( - validID, null, validEmail, validPassword, validRole, validSettings, validInbox)); + null, validEmail, validPassword, validRole, validSettings, validInbox)); } @Test @@ -49,7 +53,7 @@ void shouldThrowIfNameIsBlank() { IllegalArgumentException.class, () -> new User( - validID, " ", validEmail, validPassword, validRole, validSettings, validInbox)); + " ", validEmail, validPassword, validRole, validSettings, validInbox)); } @Nested @@ -61,7 +65,7 @@ void shouldThrowIfEmailIsNull() { IllegalArgumentException.class, () -> new User( - validID, validName, null, validPassword, validRole, validSettings, validInbox)); + validName, null, validPassword, validRole, validSettings, validInbox)); } @Test @@ -70,7 +74,7 @@ void shouldThrowIfEmailIsBlank() { IllegalArgumentException.class, () -> new User( - validID, validName, " ", validPassword, validRole, validSettings, validInbox)); + validName, " ", validPassword, validRole, validSettings, validInbox)); } @Test @@ -79,7 +83,7 @@ void shouldThrowIfEmailDoesNotContainAt() { IllegalArgumentException.class, () -> new User( - validID, + validName, "test.gmail.com", validPassword, @@ -94,7 +98,7 @@ void shouldThrowIfEmailDoesNotContainPeriod() { IllegalArgumentException.class, () -> new User( - validID, + validName, "test@gmailcom", validPassword, @@ -109,7 +113,7 @@ void shouldThrowIfPasswordIsNull() { assertThrows( IllegalArgumentException.class, () -> - new User(validID, validName, validEmail, null, validRole, validSettings, validInbox)); + new User( validName, validEmail, null, validRole, validSettings, validInbox)); } @Test @@ -118,7 +122,7 @@ void shouldThrowIfRoleIsNull() { IllegalArgumentException.class, () -> new User( - validID, validName, validEmail, validPassword, null, validSettings, validInbox)); + validName, validEmail, validPassword, null, validSettings, validInbox)); } @Test @@ -126,7 +130,7 @@ void shouldThrowIfPasswordIsBlank() { assertThrows( IllegalArgumentException.class, () -> - new User(validID, validName, validEmail, " ", validRole, validSettings, validInbox)); + new User( validName, validEmail, " ", validRole, validSettings, validInbox)); } @Test @@ -134,7 +138,7 @@ void shouldThrowIfSettingsIsNull() { assertThrows( IllegalArgumentException.class, () -> - new User(validID, validName, validEmail, validPassword, validRole, null, validInbox)); + new User( validName, validEmail, validPassword, validRole, null, validInbox)); } @Test @@ -143,14 +147,14 @@ void shouldThrowIfInboxIsNull() { IllegalArgumentException.class, () -> new User( - validID, validName, validEmail, validPassword, validRole, validSettings, null)); + validName, validEmail, validPassword, validRole, validSettings, null)); } @Test void shouldCreateUser() { User user = new User( - validID, validName, validEmail, validPassword, validRole, validSettings, validInbox); + validName, validEmail, validPassword, validRole, validSettings, validInbox); assertAll( () -> assertEquals(validID, user.getId()), From 2408d902f42bbeaa958aec3a89c6e67abe90784e Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 13:02:48 +0100 Subject: [PATCH 22/25] Fix: Anonymous has correct contructor --- .../java/ntnu/sytemutvikling/team6/models/Donation.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java index 1fdaa6f..70f6268 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java @@ -38,13 +38,7 @@ public Donation(double amount, LocalDateTime date, Charity charity, User donor) this.date = date; this.charity = charity; this.donor = donor; - - // ASSUMES that this is the way to get the anonymous setting from the user's settings. - if (donor.getSettings().isAnonymous() == false) { - this.isAnonymous = true; - } else { - this.isAnonymous = false; - } + this.isAnonymous = donor.getSettings().isAnonymous(); } /* Getters for the donation's attributes */ From 3ab00dfc9d857f46c7d72a4bd6de4e1d6aa50f9a Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 13:05:44 +0100 Subject: [PATCH 23/25] Fixes: All current Tests are valid --- .../team6/models/DonationTest.java | 8 +------- .../team6/models/FeedbackTest.java | 1 + .../team6/models/user/UserTest.java | 15 --------------- .../team6/security/PasswordHasherTest.java | 1 + 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java index c4851b5..17bfaef 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/DonationTest.java @@ -43,11 +43,6 @@ void testDonationInitialization() { void testAnonymousFlagWhenUserIsAnonymous() { Donation donation = new Donation(100, LocalDateTime.now(), charity, user); - // According to your logic: - // if donor.getSettings().isAnonymous() == false → donation.isAnonymous = true - // else → donation.isAnonymous = false - // - // So if user.isAnonymous() == true → donation.isAnonymous should be false assertFalse(donation.isAnonymous()); } @@ -55,8 +50,7 @@ void testAnonymousFlagWhenUserIsAnonymous() { void testAnonymousFlagWhenUserIsNotAnonymous() { Donation donation = new Donation(100, LocalDateTime.now(), charity, user); - // If user.isAnonymous() == false → donation.isAnonymous = true - assertTrue(donation.isAnonymous()); + assertFalse(donation.isAnonymous()); } @Test diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java index b21def7..a9fc57d 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/FeedbackTest.java @@ -50,6 +50,7 @@ void testAnonymousFlagWhenUserIsAnonymous() { @Test void testAnonymousFlagWhenUserIsNotAnonymous() { + user.getSettings().toggleAnonymousMode(); Feedback feedback = new Feedback(user, "Not anonymous"); assertTrue(feedback.isAnonymous()); diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java index d12331f..fd20091 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/models/user/UserTest.java @@ -24,20 +24,6 @@ class constructorTests { private final Settings validSettings = new Settings(); private final Inbox validInbox = new Inbox(); - @Test - void shouldThrowIfIdIsNull() { - assertThrows( - IllegalArgumentException.class, - () -> - new User( - validName, - validEmail, - validPassword, - validRole, - validSettings, - validInbox)); - } - @Test void shouldThrowIfNameIsNull() { assertThrows( @@ -157,7 +143,6 @@ void shouldCreateUser() { validName, validEmail, validPassword, validRole, validSettings, validInbox); assertAll( - () -> assertEquals(validID, user.getId()), () -> assertEquals(validName, user.getName()), () -> assertEquals(validEmail, user.getEmail()), () -> assertEquals(validRole, user.getRole()), diff --git a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java index dada18f..d195989 100644 --- a/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java +++ b/helpmehelpapplication/src/test/java/ntnu/systemutvikling/team6/security/PasswordHasherTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.*; +import ntnu.sytemutvikling.team6.security.PasswordHasher; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; From afa366b15f616569abd6f98fc66b093cd36bdd68 Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 13:06:22 +0100 Subject: [PATCH 24/25] Feature: gitignore for better workflow --- helpmehelpapplication/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 helpmehelpapplication/.gitignore diff --git a/helpmehelpapplication/.gitignore b/helpmehelpapplication/.gitignore new file mode 100644 index 0000000..e673575 --- /dev/null +++ b/helpmehelpapplication/.gitignore @@ -0,0 +1,2 @@ +.idea/ +target/ \ No newline at end of file From 23110a052b510850982f990d01f87c546de0d0ec Mon Sep 17 00:00:00 2001 From: AdrianBalunan Date: Thu, 5 Mar 2026 13:06:46 +0100 Subject: [PATCH 25/25] Fix: Hotfixes and better Anonymous handling --- .../sytemutvikling/team6/models/Charity.java | 173 +++++++++--------- .../team6/models/CharityRegistry.java | 48 +++-- .../team6/service/AuthenticationService.java | 1 + .../team6/service/CharityService.java | 4 +- 4 files changed, 110 insertions(+), 116 deletions(-) diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java index 84fb639..2c2cb3f 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Charity.java @@ -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; 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 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; - } + /* 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 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; + } } diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/CharityRegistry.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/CharityRegistry.java index a8d698e..2935c74 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/CharityRegistry.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/CharityRegistry.java @@ -2,37 +2,35 @@ import java.util.*; -public class CharityRegistry{ - private final List charities; +public class CharityRegistry { + private final List charities; - public CharityRegistry(){ - this.charities = new ArrayList<>(); - } + public CharityRegistry() { + this.charities = new ArrayList<>(); + } - public List getAllCharities(){ - return Collections.unmodifiableList(charities); - } + public List getAllCharities() { + return Collections.unmodifiableList(charities); + } - public Optional findCharityById(UUID charityId){ - if(charityId == null){ - throw new IllegalArgumentException("CharityId can not be null."); - } - return charities.stream() - .filter(charity -> charityId.equals(charity.getId())) - .findFirst(); + public Optional findCharityById(UUID charityId) { + if (charityId == null) { + throw new IllegalArgumentException("CharityId can not be null."); } + return charities.stream().filter(charity -> charityId.equals(charity.getId())).findFirst(); + } - public void addCharity(Charity charity){ - if(charity == null){ - throw new IllegalArgumentException("Charity can not be null."); + public void addCharity(Charity charity) { + if (charity == null) { + throw new IllegalArgumentException("Charity can not be null."); } charities.add(charity); - } + } - public boolean removeCharity(UUID charityId){ - if(charityId == null){ - throw new IllegalArgumentException("CharityId can not be null."); - } - return charities.removeIf(charity -> charityId.equals(charity.getId())); + public boolean removeCharity(UUID charityId) { + if (charityId == null) { + throw new IllegalArgumentException("CharityId can not be null."); } -} \ No newline at end of file + return charities.removeIf(charity -> charityId.equals(charity.getId())); + } +} diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/AuthenticationService.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/AuthenticationService.java index e69de29..8b13789 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/AuthenticationService.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/AuthenticationService.java @@ -0,0 +1 @@ + diff --git a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/CharityService.java b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/CharityService.java index 62fe87c..3b66851 100644 --- a/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/CharityService.java +++ b/helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/service/CharityService.java @@ -1,5 +1,3 @@ package ntnu.sytemutvikling.team6.service; -public class CharityService { - -} +public class CharityService {}