From 2e6a443522f81f9e08474d912a7076fe4ea6e3dc Mon Sep 17 00:00:00 2001 From: whitesnowx Date: Sun, 17 Mar 2024 10:04:14 +0800 Subject: [PATCH] Change comparator test to fix order and wrong comparator usedd --- .../comparators/FacultyComparatorTest.java | 8 ++++---- .../person/comparators/ModuleComparatorTest.java | 2 +- .../person/comparators/NameComparatorTest.java | 4 ++-- .../person/comparators/PhoneComparatorTest.java | 4 ++-- .../person/comparators/VenueComparatorTest.java | 16 ++++++++-------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/test/java/staffconnect/model/person/comparators/FacultyComparatorTest.java b/src/test/java/staffconnect/model/person/comparators/FacultyComparatorTest.java index b0a1b95e806..edb18188e03 100644 --- a/src/test/java/staffconnect/model/person/comparators/FacultyComparatorTest.java +++ b/src/test/java/staffconnect/model/person/comparators/FacultyComparatorTest.java @@ -17,10 +17,10 @@ public class FacultyComparatorTest { @Test public void doesNotEquals() { - assertNotEquals(VENUE_COMPARATOR, FACULTY_COMPARATOR); - assertNotEquals(VENUE_COMPARATOR, MODULE_COMPARATOR); - assertNotEquals(VENUE_COMPARATOR, NAME_COMPARATOR); - assertNotEquals(VENUE_COMPARATOR, PHONE_COMPARATOR); + assertNotEquals(FACULTY_COMPARATOR, NAME_COMPARATOR); + assertNotEquals(FACULTY_COMPARATOR, PHONE_COMPARATOR); + assertNotEquals(FACULTY_COMPARATOR, MODULE_COMPARATOR); + assertNotEquals(FACULTY_COMPARATOR, VENUE_COMPARATOR); } @Test diff --git a/src/test/java/staffconnect/model/person/comparators/ModuleComparatorTest.java b/src/test/java/staffconnect/model/person/comparators/ModuleComparatorTest.java index 63b1083d428..0aaea6522b2 100644 --- a/src/test/java/staffconnect/model/person/comparators/ModuleComparatorTest.java +++ b/src/test/java/staffconnect/model/person/comparators/ModuleComparatorTest.java @@ -16,9 +16,9 @@ public class ModuleComparatorTest { @Test public void doesNotEquals() { - assertNotEquals(MODULE_COMPARATOR, FACULTY_COMPARATOR); assertNotEquals(MODULE_COMPARATOR, NAME_COMPARATOR); assertNotEquals(MODULE_COMPARATOR, PHONE_COMPARATOR); + assertNotEquals(MODULE_COMPARATOR, FACULTY_COMPARATOR); assertNotEquals(MODULE_COMPARATOR, VENUE_COMPARATOR); } diff --git a/src/test/java/staffconnect/model/person/comparators/NameComparatorTest.java b/src/test/java/staffconnect/model/person/comparators/NameComparatorTest.java index 5c0873580a9..d2da0e40050 100644 --- a/src/test/java/staffconnect/model/person/comparators/NameComparatorTest.java +++ b/src/test/java/staffconnect/model/person/comparators/NameComparatorTest.java @@ -18,9 +18,9 @@ public class NameComparatorTest { @Test public void doesNotEquals() { - assertNotEquals(NAME_COMPARATOR, FACULTY_COMPARATOR); - assertNotEquals(NAME_COMPARATOR, MODULE_COMPARATOR); assertNotEquals(NAME_COMPARATOR, PHONE_COMPARATOR); + assertNotEquals(NAME_COMPARATOR, MODULE_COMPARATOR); + assertNotEquals(NAME_COMPARATOR, FACULTY_COMPARATOR); assertNotEquals(NAME_COMPARATOR, VENUE_COMPARATOR); } diff --git a/src/test/java/staffconnect/model/person/comparators/PhoneComparatorTest.java b/src/test/java/staffconnect/model/person/comparators/PhoneComparatorTest.java index ae8770818ae..5bcd75c86c6 100644 --- a/src/test/java/staffconnect/model/person/comparators/PhoneComparatorTest.java +++ b/src/test/java/staffconnect/model/person/comparators/PhoneComparatorTest.java @@ -17,9 +17,9 @@ public class PhoneComparatorTest { @Test public void doesNotEquals() { - assertNotEquals(PHONE_COMPARATOR, FACULTY_COMPARATOR); - assertNotEquals(PHONE_COMPARATOR, MODULE_COMPARATOR); assertNotEquals(PHONE_COMPARATOR, NAME_COMPARATOR); + assertNotEquals(PHONE_COMPARATOR, MODULE_COMPARATOR); + assertNotEquals(PHONE_COMPARATOR, FACULTY_COMPARATOR); assertNotEquals(PHONE_COMPARATOR, VENUE_COMPARATOR); } diff --git a/src/test/java/staffconnect/model/person/comparators/VenueComparatorTest.java b/src/test/java/staffconnect/model/person/comparators/VenueComparatorTest.java index d475237e0a5..517b66009a3 100644 --- a/src/test/java/staffconnect/model/person/comparators/VenueComparatorTest.java +++ b/src/test/java/staffconnect/model/person/comparators/VenueComparatorTest.java @@ -17,22 +17,22 @@ public class VenueComparatorTest { @Test public void doesNotEquals() { - assertNotEquals(VENUE_COMPARATOR, FACULTY_COMPARATOR); - assertNotEquals(VENUE_COMPARATOR, MODULE_COMPARATOR); assertNotEquals(VENUE_COMPARATOR, NAME_COMPARATOR); assertNotEquals(VENUE_COMPARATOR, PHONE_COMPARATOR); + assertNotEquals(VENUE_COMPARATOR, MODULE_COMPARATOR); + assertNotEquals(VENUE_COMPARATOR, FACULTY_COMPARATOR); } @Test public void checkComparator() { - assertTrue(PHONE_COMPARATOR.compare(ELLE, CARL) <= -1); // michegan ave < wall street - assertTrue(PHONE_COMPARATOR.compare(CARL, ELLE) >= 1); // wall street > michegan ave + assertTrue(VENUE_COMPARATOR.compare(ELLE, CARL) <= -1); // michegan ave < wall street + assertTrue(VENUE_COMPARATOR.compare(CARL, ELLE) >= 1); // wall street > michegan ave - assertTrue(PHONE_COMPARATOR.compare(ELLE, GEORGE) <= -1); // michegan ave < 4th street - assertTrue(PHONE_COMPARATOR.compare(GEORGE, ELLE) >= 1); // 4th street > michegan ave + assertTrue(VENUE_COMPARATOR.compare(GEORGE, ELLE) <= 1); // 4th street > michegan ave + assertTrue(VENUE_COMPARATOR.compare(ELLE, GEORGE) >= -1); // michegan ave < 4th street - assertEquals(PHONE_COMPARATOR.compare(ELLE, ELLE), 0); // michegan ave = michegan ave - assertEquals(PHONE_COMPARATOR.compare(GEORGE, GEORGE), 0); // 4th street = 4th street + assertEquals(VENUE_COMPARATOR.compare(ELLE, ELLE), 0); // michegan ave = michegan ave + assertEquals(VENUE_COMPARATOR.compare(GEORGE, GEORGE), 0); // 4th street = 4th street } }