Skip to content

Commit

Permalink
debugging: changes in user name(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
cathrkri committed Apr 17, 2026
1 parent 863b00b commit 0881467
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,22 @@ void setUp() {
void addDonationShouldInsertDonationIntoDatabase() throws Exception {
double amount = 100.0;

DonationDAO.addDonation(
charity,
new User(UUID.randomUUID().toString(), "ad", "dwad@ca.com", "CHARITY_USER", "NORMAL_USER"),
amount);
DonationDAO donationDAO = new DonationDAO(new DatabaseConnection());

donationDAO.addDonation(
charity,
new User(
UUID.randomUUID().toString(),
"ad",
"aduser",
"dwad@ca.com",
"secret",
"NORMAL_USER"),
amount);

try (Connection conn = new DatabaseConnection().getMySqlConnection()) {
PreparedStatement stmt =
conn.prepareStatement("SELECT amount FROM Donations WHERE charity_id = ?");
conn.prepareStatement("SELECT amount FROM Donations WHERE charity_id = ?");

stmt.setString(1, charity.getUUID().toString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void getFeedbackforCharityUUID_oneRow_returnsSingleFeedback() throws Exception {
Feedback feedback = result.get(0);
assertEquals(feedback1Id, feedback.getFeedbackId().toString());
assertEquals("Very helpful!", feedback.getComment());
assertEquals("Bob", feedback.getUser().getName());
assertEquals("Bob", feedback.getUser().getDisplayName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ public void setup() {
charity = new Charity("Charity1", "www.aaaa.com", "Cancer", false, "unverified");

user =
new User("Name", "Valid@gmail.com", "123", Role.NORMAL_USER, new Settings(), new Inbox());
new User(
"Name",
"username",
"Valid@gmail.com",
"123",
Role.NORMAL_USER,
new Settings(),
new Inbox());
}

// --- Tests ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ class FeedbackTest {
public void setup() {
settings = new Settings(); // default anonymous = true
user =
new User("Name", "Valid@gmail.com", "123", Role.NORMAL_USER, new Settings(), new Inbox());
new User(
"Name",
"username",
"Valid@gmail.com",
"123",
Role.NORMAL_USER,
new Settings(),
new Inbox());
}

// --- Tests ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,21 @@ void shouldThrowIfRoleIsNull() {
validInbox));
}

@Test
void shouldThrowIfPasswordIsBlank() {
assertThrows(
IllegalArgumentException.class,
() ->
new User(
validDisplayName,
validUsername,
validEmail,
" ",
validRole,
validSettings,
validInbox));
}

@Test
void shouldThrowIfSettingsIsNull() {
assertThrows(
Expand Down

0 comments on commit 0881467

Please sign in to comment.