Skip to content

Commit

Permalink
Add Test Cases
Browse files Browse the repository at this point in the history
  • Loading branch information
WinstonJin committed Oct 30, 2024
1 parent 4a78621 commit 665f7ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/main/java/seedu/address/logic/commands/HelpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,21 @@ public class HelpCommand extends Command {
private final String message;
private final boolean isHelp;

/**
* Constructs a {@code HelpCommand} with a custom help message.
* This constructor is used when a specific help message is needed.
*
* @param message the custom help message to be shown when the command is executed
*/
public HelpCommand(String message) {
this.message = message;
this.isHelp = false;
}

/**
* Constructs a {@code HelpCommand} with the default help message.
* This constructor is used when general help information is requested.
*/
public HelpCommand() {
this.message = SHOWING_HELP_MESSAGE;
this.isHelp = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class HelpCommandTest {
@Test
public void execute_help_success() {
CommandResult expectedCommandResult = new CommandResult(SHOWING_HELP_MESSAGE, true, false);
assertCommandSuccess(new HelpCommand(SHOWING_HELP_MESSAGE), model, expectedCommandResult, expectedModel);
assertCommandSuccess(new HelpCommand(), model, expectedCommandResult, expectedModel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public void parseCommand_find() throws Exception {
@Test
public void parseCommand_help() throws Exception {
assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD) instanceof HelpCommand);
//assertEquals(parser.parseCommand(HelpCommand.COMMAND_WORD + " list"),
// new HelpCommand(HelpCommand.HELP_LIST));
assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " list") instanceof HelpCommand);
}

@Test
Expand Down

0 comments on commit 665f7ce

Please sign in to comment.