Skip to content

Commit

Permalink
Change comparator test to fix order and wrong comparator usedd
Browse files Browse the repository at this point in the history
  • Loading branch information
whitesnowx committed Mar 17, 2024
1 parent 1f6d93b commit 2e6a443
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

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

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

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

0 comments on commit 2e6a443

Please sign in to comment.