Skip to content

Commit

Permalink
style[test/wrapper]: order imports and split too long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucy Ciara Herud-Thomassen authored and Lucy Ciara Herud-Thomassen committed Apr 9, 2026
1 parent 1a5616e commit ac86537
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object[]> users;
Expand Down Expand Up @@ -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<Object[]>();
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<Object[]>();
this.donations2.add(this.johnDonation);
this.donations2.add(this.janeDonation);
Expand Down Expand Up @@ -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());
});
}
Expand Down Expand Up @@ -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());
Expand Down
22 changes: 6 additions & 16 deletions src/test/java/edu/group5/app/model/wrapper/DbWrapperUserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -54,8 +45,9 @@ void init() {
this.users3 = new ArrayList<Object[]>();
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<Object[]>();
this.repeatedUsers.add(this.repeatingJoeJoe);
this.repeatedUsers.add(this.repeatingJoeJoe);
Expand Down Expand Up @@ -187,6 +179,4 @@ public void addingUserListWithNullInRowThrowsExpectedException() {
assertTrue(this.db.disconnect());
assertEquals("One or more rows in data contains null values", exception.getMessage());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down

0 comments on commit ac86537

Please sign in to comment.