Skip to content

Commit

Permalink
Fix all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alxkohh committed Nov 10, 2019
1 parent 8aff845 commit 3829901
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ void testGetCommand() throws InvalidCommandArgumentsException {
BookmarkCommandFactory factory = new BookmarkCommandFactory(questionsLogic);
assertTrue(factory.getCommand("1") instanceof BookmarkCommand);

String expectedMessage = "Invalid input. Please call the bookmark command in this format: <bookmark [id]> , "
+ "where id is the positive integer beside the question title.";
assertThrows(InvalidCommandArgumentsException.class,
"Invalid index entered.", () -> factory.getCommand("testerString"));
expectedMessage, () -> factory.getCommand("testerString"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class BookmarkCommandTest {
void testExecute() throws CommandException {
MockQuestionsLogic questionsLogic = MockQuestionsLogic.getMockQuestionsLogicWithTypicalQuestions();
BookmarkCommand bookmarkCommand = new BookmarkCommand(-1, questionsLogic);
assertThrows(CommandException.class,
"Index -1 entered out of range for current list of questions.", () ->
bookmarkCommand.execute());
String expectedMessage = "No question with id -1 found.";
assertThrows(CommandException.class, expectedMessage, () -> bookmarkCommand.execute());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ void testGetCommand() throws InvalidCommandArgumentsException {
DeleteBookmarkCommandFactory factory = new DeleteBookmarkCommandFactory(questionsLogic);
assertTrue(factory.getCommand("1") instanceof DeleteBookmarkCommand);

assertThrows(InvalidCommandArgumentsException.class,
"Invalid index entered.", () -> factory.getCommand("testerString"));
String expectedMessage = "Invalid input. Please call the deletebookmark command in this format: "
+ "<deletebookmark [id]> , where id is the positive integer beside the question title.";
assertThrows(InvalidCommandArgumentsException.class, expectedMessage, () ->
factory.getCommand("testerString"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class DeleteBookmarkCommandTest {
void testExecute() throws CommandException {
MockQuestionsLogic questionsLogic = MockQuestionsLogic.getMockQuestionsLogicWithTypicalQuestions();
DeleteBookmarkCommand deleteBookmarkCommand = new DeleteBookmarkCommand(-1, questionsLogic);
assertThrows(CommandException.class,
"Index -1 entered out of range for current list of questions.", () ->
deleteBookmarkCommand.execute());
String expectedMessage = "No question with id -1 found.";
assertThrows(CommandException.class, expectedMessage, () -> deleteBookmarkCommand.execute());
}
}

0 comments on commit 3829901

Please sign in to comment.