Skip to content

Commit

Permalink
Merge pull request #157 from Xilef121/branch-SortType-testing
Browse files Browse the repository at this point in the history
Create test class for SortType
  • Loading branch information
cocoanautz authored Apr 15, 2024
2 parents 17eb6a7 + 2607c6d commit 4d9cdae
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package seedu.address.commons.core.sorttype;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;

import org.junit.jupiter.api.Test;

public class SortTypeTest {

@Test
public void testGetSortType() {
assertEquals(SortType.ALPHABETICAL_ASCENDING, SortType.getSortType('a'));
assertEquals(SortType.STARTDATE_ASCENDING, SortType.getSortType('s'));
assertEquals(SortType.ENDDATE_ASCENDING, SortType.getSortType('e'));

// Test invalid preference
assertNull(SortType.getSortType('x'));
}

@Test
public void testGetPref() {
assertEquals('a', SortType.ALPHABETICAL_ASCENDING.getPref());
assertEquals('s', SortType.STARTDATE_ASCENDING.getPref());
assertEquals('e', SortType.ENDDATE_ASCENDING.getPref());
}

@Test
public void testEquality() {
assertSame(SortType.ALPHABETICAL_ASCENDING, SortType.ALPHABETICAL_ASCENDING);
assertSame(SortType.STARTDATE_ASCENDING, SortType.STARTDATE_ASCENDING);
assertSame(SortType.ENDDATE_ASCENDING, SortType.ENDDATE_ASCENDING);
}
}

0 comments on commit 4d9cdae

Please sign in to comment.