diff --git a/src/main/java/seedu/address/model/person/PersonComparator.java b/src/main/java/seedu/address/model/person/PersonComparator.java index 34009b1614e..204637438e9 100644 --- a/src/main/java/seedu/address/model/person/PersonComparator.java +++ b/src/main/java/seedu/address/model/person/PersonComparator.java @@ -1,5 +1,7 @@ package seedu.address.model.person; +import static seedu.address.model.Model.COMPARATOR_SHOW_ORIGINAL_ORDER; + import java.util.Comparator; /** @@ -41,7 +43,7 @@ public static Comparator getComparator(SortCriteria sortCriteria, SortOr comparator = Comparator.comparing(Person::getSchedule); break; default: - return Comparator.comparing(Person::getName); + return COMPARATOR_SHOW_ORIGINAL_ORDER; } if (sortOrder == SortOrder.DESC) { return comparator.reversed(); diff --git a/src/test/java/seedu/address/model/person/PersonComparatorTest.java b/src/test/java/seedu/address/model/person/PersonComparatorTest.java index 8a5cdd54cac..4bb9d13ecbc 100644 --- a/src/test/java/seedu/address/model/person/PersonComparatorTest.java +++ b/src/test/java/seedu/address/model/person/PersonComparatorTest.java @@ -95,10 +95,10 @@ public void getComparator() { // sort by invalid or default criteria Comparator invalidAscComparator = PersonComparator.getComparator(SortCriteria.INVALID, SortOrder.ASC); // ascending - assertTrue(invalidAscComparator.compare(alice, bob) < 0); + assertTrue(invalidAscComparator.compare(alice, bob) == 0); assertEquals(0, invalidAscComparator.compare(alice, aliceCopy)); // descending - assertTrue(invalidAscComparator.compare(alice, bob) < 0); + assertTrue(invalidAscComparator.compare(alice, bob) == 0); assertEquals(0, invalidAscComparator.compare(alice, aliceCopy)); } }