Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nixonwidjaja committed Nov 2, 2023
1 parent 5686dac commit af9c2f9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/java/seedu/address/model/person/MonthTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;
Expand All @@ -22,6 +23,13 @@ public void execute_monthEqualsSuccess() {
assertNotEquals(testMonth, null);
}

@Test
public void execute_monthFailure() {
assertThrows(Exception.class, () -> new Month(0));
assertThrows(Exception.class, () -> new Month(13));
assertThrows(Exception.class, () -> new Month(100000));
}

@Test
public void execute_containsAlphabetsSuccess() {
assertTrue(Month.containsAlphabetsOrDecimals(MONTH_WITH_CHARACTERS));
Expand Down Expand Up @@ -60,6 +68,7 @@ public void execute_doesNotContainsNegativeSuccess() {
@Test
public void execute_invalidMonth() {
assertFalse(Month.isValidMonth(INVALID_MONTH));
assertFalse(Month.isValidMonth(NEGATIVE_MONTH));
}

@Test
Expand Down

0 comments on commit af9c2f9

Please sign in to comment.