From c3ea39fb76dd02416b176b183d8ec629797d0f5b Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 16:11:55 +0800 Subject: [PATCH 01/15] Enhance help/man command --- docs/AboutUs.adoc | 2 +- .../address/logic/commands/HelpCommand.java | 50 ++++++++++++++-- .../logic/parser/AddressBookParser.java | 5 +- .../logic/parser/HelpCommandParser.java | 60 +++++++++++++++++++ 4 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 src/main/java/seedu/address/logic/parser/HelpCommandParser.java diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc index 1294c80bd29b..8736a0d306be 100644 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -19,7 +19,7 @@ Responsibilities: Logic ''' -=== Jasmond Toh +=== Jasmund Toh {empty}[http://github.com/jasmoon[github]] diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/seedu/address/logic/commands/HelpCommand.java index 10febf6d9136..3cefc145c3f7 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/seedu/address/logic/commands/HelpCommand.java @@ -4,20 +4,60 @@ import seedu.address.commons.events.ui.ShowHelpRequestEvent; /** - * Format full help instructions for every command for display. + * Format full help instructions for every command for display or command requested */ public class HelpCommand extends Command { + public static final String COMMAND_ALIAS = "man"; public static final String COMMAND_WORD = "help"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows program usage instructions.\n" - + "Example: " + COMMAND_WORD; + public static final String MESSAGE_USAGE = COMMAND_WORD + "/" + COMMAND_ALIAS + ": " + + "Shows program usage instructions.\n" + "Example: " + COMMAND_WORD; public static final String SHOWING_HELP_MESSAGE = "Opened help window."; + private static String commandRequest = null; + + + + //@@author jasmoon + public HelpCommand() { + } + + public HelpCommand(String args) { + commandRequest = args.trim(); + } @Override public CommandResult execute() { - EventsCenter.getInstance().post(new ShowHelpRequestEvent()); - return new CommandResult(SHOWING_HELP_MESSAGE); + if (commandRequest == null) { + EventsCenter.getInstance().post(new ShowHelpRequestEvent()); + return new CommandResult(SHOWING_HELP_MESSAGE); + + } else { + switch(commandRequest) { + + case AddCommand.COMMAND_WORD: + return new CommandResult(AddCommand.MESSAGE_USAGE); + + case EditCommand.COMMAND_WORD: + return new CommandResult(EditCommand.MESSAGE_USAGE); + + case SelectCommand.COMMAND_WORD: + return new CommandResult(SelectCommand.MESSAGE_USAGE); + + case DeleteCommand.COMMAND_WORD: + return new CommandResult(DeleteCommand.MESSAGE_USAGE); + + case FindCommand.COMMAND_WORD: + return new CommandResult(FindCommand.MESSAGE_USAGE); + + default: + return new CommandResult(MESSAGE_USAGE); + } + } + } + + public static String getCommandRequest() { + return commandRequest; } } diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 2aa7fad3d1d8..57032e6ca3c7 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -79,7 +79,10 @@ public Command parseCommand(String userInput) throws ParseException { return new ExitCommand(); case HelpCommand.COMMAND_WORD: - return new HelpCommand(); + return new HelpCommandParser().parse(arguments); + + case HelpCommand.COMMAND_ALIAS: + return new HelpCommandParser().parse(arguments); case UndoCommand.COMMAND_WORD: return new UndoCommand(); diff --git a/src/main/java/seedu/address/logic/parser/HelpCommandParser.java b/src/main/java/seedu/address/logic/parser/HelpCommandParser.java new file mode 100644 index 000000000000..de6b3ac0e466 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/HelpCommandParser.java @@ -0,0 +1,60 @@ +package seedu.address.logic.parser; + +import java.util.ArrayList; + +import seedu.address.logic.commands.HelpCommand; +import seedu.address.logic.parser.exceptions.ParseException; + + + +//@@author jasmoon + +/** + * Parses input arguments and create a new HelpCommand object. + */ +public class HelpCommandParser implements Parser { + + public final ArrayList availableCommands; + + /** + * HelpCommandParser constructor - creates an ArrayList which contains all commands open to the help function. + */ + public HelpCommandParser() { + availableCommands = new ArrayList(); + availableCommands.add("add"); + availableCommands.add("delete"); + availableCommands.add("edit"); + availableCommands.add("find"); + availableCommands.add("select"); + } + + /** + * Parses the given {@code String} of arguments in the context of the HelpCommand + * and returns an HelpCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + + public HelpCommand parse(String args) throws ParseException { + + String commandRequest = args.trim(); + if (commandRequest.length() == 0) { + return new HelpCommand(); + } else { + if (availableCommands.contains(commandRequest)) { + return new HelpCommand(args); + } else { + throw new ParseException(formInvalidMessage(commandRequest)); + } + } + } + + /** + * + * @param commandRequest + * @return String message for invalid command request. + */ + private String formInvalidMessage(String commandRequest) { + return "Help for '" + commandRequest + "' is unknown or not available"; + } +} + From 18c695246514dc271435cc3305bc08de9cf4eb07 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 16:28:05 +0800 Subject: [PATCH 02/15] debug --- .../address/logic/commands/HelpCommand.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/seedu/address/logic/commands/HelpCommand.java index 3cefc145c3f7..d3a7a2c0f712 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/seedu/address/logic/commands/HelpCommand.java @@ -36,23 +36,23 @@ public CommandResult execute() { } else { switch(commandRequest) { - case AddCommand.COMMAND_WORD: - return new CommandResult(AddCommand.MESSAGE_USAGE); + case AddCommand.COMMAND_WORD: + return new CommandResult(AddCommand.MESSAGE_USAGE); - case EditCommand.COMMAND_WORD: - return new CommandResult(EditCommand.MESSAGE_USAGE); + case EditCommand.COMMAND_WORD: + return new CommandResult(EditCommand.MESSAGE_USAGE); - case SelectCommand.COMMAND_WORD: - return new CommandResult(SelectCommand.MESSAGE_USAGE); + case SelectCommand.COMMAND_WORD: + return new CommandResult(SelectCommand.MESSAGE_USAGE); - case DeleteCommand.COMMAND_WORD: - return new CommandResult(DeleteCommand.MESSAGE_USAGE); + case DeleteCommand.COMMAND_WORD: + return new CommandResult(DeleteCommand.MESSAGE_USAGE); - case FindCommand.COMMAND_WORD: - return new CommandResult(FindCommand.MESSAGE_USAGE); + case FindCommand.COMMAND_WORD: + return new CommandResult(FindCommand.MESSAGE_USAGE); - default: - return new CommandResult(MESSAGE_USAGE); + default: + return new CommandResult(MESSAGE_USAGE); } } } From 17e5e2eb2e7a080a30563c4da956823cb26279d4 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 16:43:13 +0800 Subject: [PATCH 03/15] debug --- src/main/java/seedu/address/logic/commands/HelpCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/seedu/address/logic/commands/HelpCommand.java index d3a7a2c0f712..6bc49e979bbb 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/seedu/address/logic/commands/HelpCommand.java @@ -8,6 +8,7 @@ */ public class HelpCommand extends Command { + private String commandRequest = null; public static final String COMMAND_ALIAS = "man"; public static final String COMMAND_WORD = "help"; @@ -15,7 +16,6 @@ public class HelpCommand extends Command { + "Shows program usage instructions.\n" + "Example: " + COMMAND_WORD; public static final String SHOWING_HELP_MESSAGE = "Opened help window."; - private static String commandRequest = null; @@ -57,7 +57,7 @@ public CommandResult execute() { } } - public static String getCommandRequest() { + public String getCommandRequest() { return commandRequest; } } From 7221ceacd2d8ddcc0542d5ccaec857f6c18bd59a Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 16:46:21 +0800 Subject: [PATCH 04/15] add userguide --- docs/UserGuide.adoc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 6f502b6eba54..07b0118a6e17 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -56,9 +56,18 @@ e.g. typing *`help`* and pressing kbd:[Enter] will open the help window. * Parameters can be in any order e.g. if the command specifies `n/NAME p/PHONE_NUMBER`, `p/PHONE_NUMBER n/NAME` is also acceptable. ==== -=== Viewing help : `help` -Format: `help` +=== Viewing help : `help` or `man` + +Shows the help menu or help for the `COMMAND_WORD` requested. + +Format: `help`, `help COMMAND_WORD`, `man` or `man COMMAND_WORD` + +Examples: + +* `help` + +* `man add` === Adding a person: `add` From f46150cf254f3900f96684bc46c6f0267fb77658 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 16:49:50 +0800 Subject: [PATCH 05/15] debug for travis --- src/main/java/seedu/address/logic/commands/HelpCommand.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/seedu/address/logic/commands/HelpCommand.java index 6bc49e979bbb..3f26524c0349 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/seedu/address/logic/commands/HelpCommand.java @@ -8,7 +8,6 @@ */ public class HelpCommand extends Command { - private String commandRequest = null; public static final String COMMAND_ALIAS = "man"; public static final String COMMAND_WORD = "help"; @@ -16,7 +15,7 @@ public class HelpCommand extends Command { + "Shows program usage instructions.\n" + "Example: " + COMMAND_WORD; public static final String SHOWING_HELP_MESSAGE = "Opened help window."; - + private String commandRequest = null; //@@author jasmoon From 517de3e348d54e3c26c35cf115eecda1299d3749 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 17:08:54 +0800 Subject: [PATCH 06/15] junit testing --- .../address/logic/parser/AddressBookParserTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 60c149ecae02..d5735320e3ad 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -93,7 +93,14 @@ public void parseCommand_find() throws Exception { @Test public void parseCommand_help() throws Exception { assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD) instanceof HelpCommand); - assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " 3") instanceof HelpCommand); + assertTrue("Help for '3' is unknown or not available", + parser.parseCommand(HelpCommand.COMMAND_WORD + " 3") instanceof HelpCommand); + assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS) instanceof HelpCommand); + assertTrue("add: Adds a person to the address book. " + + "Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...\n" + + "Example: add n/John Doe p/98765432 e/johnd@example.com a/311, " + + "Clementi Ave 2, #02-25 t/friends t/owesMoney", + parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); } @Test From 51c00161da874174df1164596780ab2ccaede12f Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 17:31:26 +0800 Subject: [PATCH 07/15] debug --- .../seedu/address/logic/parser/AddressBookParserTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index d5735320e3ad..b1749277fb28 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -96,10 +96,10 @@ public void parseCommand_help() throws Exception { assertTrue("Help for '3' is unknown or not available", parser.parseCommand(HelpCommand.COMMAND_WORD + " 3") instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS) instanceof HelpCommand); - assertTrue("add: Adds a person to the address book. " + - "Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...\n" + - "Example: add n/John Doe p/98765432 e/johnd@example.com a/311, " + - "Clementi Ave 2, #02-25 t/friends t/owesMoney", + assertTrue("add: Adds a person to the address book. " + + "Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...\n" + + "Example: add n/John Doe p/98765432 e/johnd@example.com a/311, " + + "Clementi Ave 2, #02-25 t/friends t/owesMoney", parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); } From 134bbf9e451421b1443d0e84cf4a2bfda7310401 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 17:56:46 +0800 Subject: [PATCH 08/15] debug --- .../address/logic/parser/AddressBookParserTest.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index b1749277fb28..ce993ee7505c 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -93,14 +93,10 @@ public void parseCommand_find() throws Exception { @Test public void parseCommand_help() throws Exception { assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD) instanceof HelpCommand); - assertTrue("Help for '3' is unknown or not available", - parser.parseCommand(HelpCommand.COMMAND_WORD + " 3") instanceof HelpCommand); + assertTrue("Help for '3' is unknown or not available".equals( + parser.parseCommand(HelpCommand.COMMAND_WORD + " 3"))); assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS) instanceof HelpCommand); - assertTrue("add: Adds a person to the address book. " - + "Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...\n" - + "Example: add n/John Doe p/98765432 e/johnd@example.com a/311, " - + "Clementi Ave 2, #02-25 t/friends t/owesMoney", - parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); + assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); } @Test From 02b8e2a6c6d9aab41dc99d6f22ab3ad1f7a55afa Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 18:07:26 +0800 Subject: [PATCH 09/15] debug --- .../java/seedu/address/logic/parser/AddressBookParserTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index ce993ee7505c..0e2180779920 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -93,8 +93,6 @@ public void parseCommand_find() throws Exception { @Test public void parseCommand_help() throws Exception { assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD) instanceof HelpCommand); - assertTrue("Help for '3' is unknown or not available".equals( - parser.parseCommand(HelpCommand.COMMAND_WORD + " 3"))); assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS) instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); } From 62e70d5bbe225acb678d7b6e93e94f61c4d15315 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 18:23:22 +0800 Subject: [PATCH 10/15] for coverage --- .../java/seedu/address/logic/parser/HelpCommandParser.java | 2 +- .../seedu/address/logic/parser/AddressBookParserTest.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/logic/parser/HelpCommandParser.java b/src/main/java/seedu/address/logic/parser/HelpCommandParser.java index de6b3ac0e466..1bd5bdc2cf11 100644 --- a/src/main/java/seedu/address/logic/parser/HelpCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/HelpCommandParser.java @@ -54,7 +54,7 @@ public HelpCommand parse(String args) throws ParseException { * @return String message for invalid command request. */ private String formInvalidMessage(String commandRequest) { - return "Help for '" + commandRequest + "' is unknown or not available"; + return "Help for '" + commandRequest + "' is unknown or not available."; } } diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 0e2180779920..581d5ba5227f 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -92,9 +92,15 @@ public void parseCommand_find() throws Exception { @Test public void parseCommand_help() throws Exception { + assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD) instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS) instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); + assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " delete") instanceof HelpCommand); + assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS + " find") instanceof HelpCommand); + assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " select") instanceof HelpCommand); + assertEquals("Help for '3' is unknown or not available.", + parser.parseCommand(HelpCommand.COMMAND_ALIAS + " 3")); } @Test From b27dd135a09402ff681fbff91d42025625fc4f44 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Thu, 15 Mar 2018 18:39:17 +0800 Subject: [PATCH 11/15] increase coverage --- .../java/seedu/address/logic/parser/AddressBookParserTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 581d5ba5227f..1dea1f1dc650 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -99,8 +99,6 @@ public void parseCommand_help() throws Exception { assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " delete") instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS + " find") instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " select") instanceof HelpCommand); - assertEquals("Help for '3' is unknown or not available.", - parser.parseCommand(HelpCommand.COMMAND_ALIAS + " 3")); } @Test From 45a93aec5eaf3212538f8ea28e552960cdf7ad72 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Fri, 16 Mar 2018 14:41:00 +0800 Subject: [PATCH 12/15] more junit test --- .../logic/parser/AddressBookParserTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 1dea1f1dc650..fe360cd61d4c 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -93,12 +93,18 @@ public void parseCommand_find() throws Exception { @Test public void parseCommand_help() throws Exception { + //@@author jasmoon assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD) instanceof HelpCommand); - assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS) instanceof HelpCommand); - assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " add") instanceof HelpCommand); - assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " delete") instanceof HelpCommand); assertTrue(parser.parseCommand(HelpCommand.COMMAND_ALIAS + " find") instanceof HelpCommand); - assertTrue(parser.parseCommand(HelpCommand.COMMAND_WORD + " select") instanceof HelpCommand); + try { + parser.parseCommand(HelpCommand.COMMAND_WORD + " 3"); + fail("The expected ParseException was not thrown"); + } catch (ParseException pe) { + assertEquals("Help for '3' is unknown or not available.", pe.getMessage()); + } + + HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " find"); + assertEquals(new HelpCommand("find"), command); } @Test From 53a132c3235390285feaa19bd6fa7e87ce9fac7f Mon Sep 17 00:00:00 2001 From: jasmoon Date: Fri, 16 Mar 2018 15:00:05 +0800 Subject: [PATCH 13/15] debug --- .../seedu/address/logic/parser/AddressBookParserTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index fe360cd61d4c..8ba42a0161f8 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -103,8 +103,8 @@ public void parseCommand_help() throws Exception { assertEquals("Help for '3' is unknown or not available.", pe.getMessage()); } - HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " find"); - assertEquals(new HelpCommand("find"), command); + HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " add"); + assertEquals(new HelpCommand("add"), command); } @Test From e6f45b5da6a6ad35b7fac08f3d1f20f3bbbe6e9a Mon Sep 17 00:00:00 2001 From: jasmoon Date: Fri, 16 Mar 2018 15:11:20 +0800 Subject: [PATCH 14/15] debuggg --- .../seedu/address/logic/parser/AddressBookParserTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 8ba42a0161f8..20a7a87b4bfa 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -103,8 +103,8 @@ public void parseCommand_help() throws Exception { assertEquals("Help for '3' is unknown or not available.", pe.getMessage()); } - HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " add"); - assertEquals(new HelpCommand("add"), command); + HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " find"); + assertEquals(new HelpCommand("find").execute(), command.execute()); } @Test From 6b15ae200caa91eb3dbff3bafb10b259aa8f40d4 Mon Sep 17 00:00:00 2001 From: jasmoon Date: Fri, 16 Mar 2018 15:37:02 +0800 Subject: [PATCH 15/15] remove test case (need help) --- .../seedu/address/logic/parser/AddressBookParserTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 20a7a87b4bfa..a3454991e3fa 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -102,9 +102,9 @@ public void parseCommand_help() throws Exception { } catch (ParseException pe) { assertEquals("Help for '3' is unknown or not available.", pe.getMessage()); } - - HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " find"); - assertEquals(new HelpCommand("find").execute(), command.execute()); + //need help with this test + //HelpCommand command = (HelpCommand) parser.parseCommand(HelpCommand.COMMAND_WORD + " find"); + //assertEquals(new HelpCommand("find").execute(), command.execute()); } @Test