Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[T3A2][T11-A1]FENYI YE #1091

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/seedu/addressbook/commands/CommandResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class CommandResult {

/** The feedback message to be shown to the user. Contains a description of the execution result */
public final String feedbackToUser;
private final String feedbackToUser;

/** The list of persons that was produced by the command */
private final List<? extends ReadOnlyPerson> relevantPersons;
Expand All @@ -26,6 +26,9 @@ public CommandResult(String feedbackToUser, List<? extends ReadOnlyPerson> relev
this.relevantPersons = relevantPersons;
}

public String getFeedback(){
return this.feedbackToUser;
}
/**
* Returns list of persons relevant to the command command result, if any.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/seedu/addressbook/ui/TextUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void showResultToUser(CommandResult result) {
if (resultPersons.isPresent()) {
showPersonListView(resultPersons.get());
}
showToUser(result.feedbackToUser, DIVIDER);
showToUser(result.getFeedback(), DIVIDER);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/java/seedu/addressbook/commands/AddCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void addCommand_emptyAddressBook_addressBookContainsPerson() {
assertTrue(people.contains(p));
assertEquals(1, people.immutableListView().size());
assertFalse(result.getRelevantPersons().isPresent());
assertEquals(String.format(AddCommand.MESSAGE_SUCCESS, p), result.feedbackToUser);
assertEquals(String.format(AddCommand.MESSAGE_SUCCESS, p), result.getFeedback());
}

@Test
Expand All @@ -139,7 +139,7 @@ public void addCommand_addressBookAlreadyContainsPerson_addressBookUnmodified()
CommandResult result = command.execute();

assertFalse(result.getRelevantPersons().isPresent());
assertEquals(AddCommand.MESSAGE_DUPLICATE_PERSON, result.feedbackToUser);
assertEquals(AddCommand.MESSAGE_DUPLICATE_PERSON, result.getFeedback());
UniquePersonList people = book.getAllPersons();
assertTrue(people.contains(p));
assertEquals(1, people.immutableListView().size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void assertCommandBehaviour(DeleteCommand deleteCommand, String expected

CommandResult result = deleteCommand.execute();

assertEquals(expectedMessage, result.feedbackToUser);
assertEquals(expectedMessage, result.getFeedback());
assertEquals(expectedAddressBook.getAllPersons(), actualAddressBook.getAllPersons());
}

Expand Down
2 changes: 1 addition & 1 deletion test/java/seedu/addressbook/commands/FindCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void assertFindCommandBehavior(String[] keywords, List<ReadOnlyPerson> e
FindCommand command = createFindCommand(keywords);
CommandResult result = command.execute();

assertEquals(Command.getMessageForPersonListShownSummary(expectedPersonList), result.feedbackToUser);
assertEquals(Command.getMessageForPersonListShownSummary(expectedPersonList), result.getFeedback());
}

private FindCommand createFindCommand(String[] keywords) {
Expand Down