Skip to content

Commit

Permalink
Merge pull request AY2425S1-CS2103-F09-2#229 from jinnsuke/fix-parser…
Browse files Browse the repository at this point in the history
…-test

Fix parser test
  • Loading branch information
jinnsuke authored Nov 11, 2024
2 parents 3660ca8 + 2f30694 commit 1c155d3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/java/seedu/address/logic/parser/ParserUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,24 @@ public void parseDate_validDateFormat_returnLocalDate() throws Exception {
public void parseDate_invalidDateFormat_throwsDateTimeException() throws ParseException {
assertThrows(ParseException.class, () -> ParserUtil.parseDate(INVALID_DATE_STRING));
}

@Test
public void parseInteger_validIntegerWithoutWhitespace_returnsInteger() throws Exception {
assertEquals(123, ParserUtil.parseInteger("123"));
}

@Test
public void parseInteger_validIntegerWithWhitespace_returnsTrimmedInteger() throws Exception {
assertEquals(123, ParserUtil.parseInteger(" 123 "));
}

@Test
public void parseInteger_invalidInteger_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseInteger("123abc"));
}

@Test
public void parseInteger_nullInput_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseInteger(null));
}
}

0 comments on commit 1c155d3

Please sign in to comment.