From 2db2300c7b314fdc3b8cbe6b3f45245a8d0657b5 Mon Sep 17 00:00:00 2001 From: nixonwidjaja Date: Wed, 18 Oct 2023 23:49:25 +0800 Subject: [PATCH] Add tests --- .../java/seedu/address/logic/commands/LeaveCommandTest.java | 2 ++ .../seedu/address/logic/parser/LeaveCommandParserTest.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/test/java/seedu/address/logic/commands/LeaveCommandTest.java b/src/test/java/seedu/address/logic/commands/LeaveCommandTest.java index bfb12ab4ea6..3ccae208252 100644 --- a/src/test/java/seedu/address/logic/commands/LeaveCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/LeaveCommandTest.java @@ -45,6 +45,8 @@ public void execute_failure() { Index outOfBoundIndex = Index.fromOneBased(model.getFilteredPersonList().size() + 1); LeaveCommand command = new LeaveCommand(outOfBoundIndex, "0000+0000000"); assertCommandFailure(command, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + assertCommandFailure(new LeaveCommand(INDEX_FIRST_PERSON, "0000-0000000"), model, + String.format(Leave.ILLEGAL_MONTH, "May")); Person person = model.getFilteredPersonList().get(INDEX_SECOND_PERSON.getZeroBased()); assertCommandFailure(leaveSecondCommand, model, diff --git a/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java b/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java index d0e89c77f17..d646ecff526 100644 --- a/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java @@ -37,5 +37,9 @@ public void parse_invalidArgs_throwsParseException() { assertParseFailure(parser, " 1 m/-3,3", LeaveCommand.MESSAGE_AMBIGUOUS + LeaveCommand.MESSAGE_USAGE); assertParseFailure(parser, " 1 m/z", LeaveCommand.MESSAGE_NOT_A_NUMBER + LeaveCommand.MESSAGE_USAGE); + + assertParseFailure(parser, " 1 m/0", LeaveCommand.MESSAGE_INVALID_MONTH + LeaveCommand.MESSAGE_USAGE); + + assertParseFailure(parser, " 1 m/13", LeaveCommand.MESSAGE_INVALID_MONTH + LeaveCommand.MESSAGE_USAGE); } }