From ac865375627a2193382b03d6b3cfc1641df2aeab Mon Sep 17 00:00:00 2001 From: Lucy Ciara Herud-Thomassen <86323303+LucyCiara@users.noreply.github.com> Date: Thu, 9 Apr 2026 12:51:28 +0200 Subject: [PATCH] style[test/wrapper]: order imports and split too long lines --- .../model/wrapper/DbWrapperDonationsTest.java | 32 ++++++++++++------- .../app/model/wrapper/DbWrapperUserTest.java | 22 ++++--------- .../app/model/wrapper/OrgApiWrapperTest.java | 2 -- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/test/java/edu/group5/app/model/wrapper/DbWrapperDonationsTest.java b/src/test/java/edu/group5/app/model/wrapper/DbWrapperDonationsTest.java index cf76092..1db7a90 100644 --- a/src/test/java/edu/group5/app/model/wrapper/DbWrapperDonationsTest.java +++ b/src/test/java/edu/group5/app/model/wrapper/DbWrapperDonationsTest.java @@ -12,12 +12,12 @@ import java.util.Arrays; import java.util.Date; import java.util.List; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import edu.group5.app.model.wrapper.DbWrapper; - +/** + * A test class for interactions with the donations table using the DbWrapper. + */ public class DbWrapperDonationsTest { private Object[] johnDonation; private List users; @@ -54,13 +54,15 @@ void init() { users.add(row); } - this.johnDonation = new Object[] { 1, 1, 39, new BigDecimal(20.02), new Timestamp(new Date().getTime()), - "Paypal" }; + this.johnDonation = new Object[] { + 1, 1, 39, new BigDecimal(20.02), new Timestamp(new Date().getTime()), "Paypal" + }; this.donations = new ArrayList(); this.donations.add(this.johnDonation); - this.janeDonation = new Object[] { 2, 2, 39, new BigDecimal(20.00), new Timestamp(new Date().getTime()), - "Visa debit card" }; + this.janeDonation = new Object[] { + 2, 2, 39, new BigDecimal(20.00), new Timestamp(new Date().getTime()), "Visa debit card" + }; this.donations2 = new ArrayList(); this.donations2.add(this.johnDonation); this.donations2.add(this.janeDonation); @@ -104,7 +106,12 @@ public void importDonationsIsOnlyExportDonationsTest() { assertTrue(this.db.importDonations((int) this.users.get(0)[0]).size() == 0); assertTrue(this.db.exportDonations(this.donations) == 1); assertTrue(this.db.importDonations((int) this.users.get(0)[0]).size() == 1); - assertTrue(donationEquals(this.donations.get(0), this.db.importDonations((int) this.users.get(0)[0]).get(0))); + assertTrue( + donationEquals( + this.donations.get(0), + this.db.importDonations((int) this.users.get(0)[0]).get(0) + ) + ); assertTrue(this.db.disconnect()); }); } @@ -157,9 +164,12 @@ public void addingSameDonationTwiceThrowsExpectedException2() { assertTrue(this.db.importDonations((int) this.users.get(0)[0]).size() == 0); assertTrue(this.db.importDonations((int) this.users.get(1)[0]).size() == 0); assertEquals(2, this.db.exportDonations(this.donations2)); - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - this.db.exportDonations(this.donations); - }); + IllegalArgumentException exception = assertThrows( + IllegalArgumentException.class, + () -> { + this.db.exportDonations(this.donations); + } + ); assertTrue(this.db.importDonations((int) this.users.get(0)[0]).size() == 1); assertTrue(this.db.importDonations((int) this.users.get(1)[0]).size() == 1); assertTrue(this.db.disconnect()); diff --git a/src/test/java/edu/group5/app/model/wrapper/DbWrapperUserTest.java b/src/test/java/edu/group5/app/model/wrapper/DbWrapperUserTest.java index 7aca3c0..00107de 100644 --- a/src/test/java/edu/group5/app/model/wrapper/DbWrapperUserTest.java +++ b/src/test/java/edu/group5/app/model/wrapper/DbWrapperUserTest.java @@ -2,27 +2,18 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.math.BigDecimal; -import java.util.Date; -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import edu.group5.app.model.wrapper.DbWrapper; -import javafx.util.converter.BigDecimalStringConverter; - +/** + * A class for testing interactions with the users table of the database using DbWrapper. + */ public class DbWrapperUserTest { private Object[] johnDoe; private Object[] janeDoe; @@ -54,8 +45,9 @@ void init() { this.users3 = new ArrayList(); this.users3.add(this.janeDoe); - this.repeatingJoeJoe = new Object[] { 3, "Customer", "Repeating", "JoeJoe", "repeatingjjoe@email.com", - "passwordpassword" }; + this.repeatingJoeJoe = new Object[] { + 3, "Customer", "Repeating", "JoeJoe", "repeatingjjoe@email.com", "passwordpassword" + }; this.repeatedUsers = new ArrayList(); this.repeatedUsers.add(this.repeatingJoeJoe); this.repeatedUsers.add(this.repeatingJoeJoe); @@ -187,6 +179,4 @@ public void addingUserListWithNullInRowThrowsExpectedException() { assertTrue(this.db.disconnect()); assertEquals("One or more rows in data contains null values", exception.getMessage()); } - - } diff --git a/src/test/java/edu/group5/app/model/wrapper/OrgApiWrapperTest.java b/src/test/java/edu/group5/app/model/wrapper/OrgApiWrapperTest.java index 0a643f2..0165456 100644 --- a/src/test/java/edu/group5/app/model/wrapper/OrgApiWrapperTest.java +++ b/src/test/java/edu/group5/app/model/wrapper/OrgApiWrapperTest.java @@ -9,8 +9,6 @@ import java.lang.IllegalArgumentException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import edu.group5.app.model.wrapper.OrgApiWrapper; import tools.jackson.core.exc.StreamReadException; /**