-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add remark command #2
Add remark command #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM! Thank you so much for your valuable efforts to the tp! :D
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.person.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could we rewrite the stars?
Amend constructor usage in JsonAdaptedPersonTest.java file and JsonAdaptedPerson.java file. As the JsonAdaptedPerson has an additional remark parameter, the lack of this parameter in the test file's constructor calling led to an error. Thus the constructor calls have the remark parameter specified now.
ee1a039
to
206dc1d
Compare
import seedu.address.model.person.Remark; | ||
|
||
|
||
import java.util.List; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not resolve yet sorry. The import java.*
should be placed before other import seedu.*
.
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Remark; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventhough having 2 blank lines is not violate the coding standard, but might ask if you wanna reduce it to one?
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.commons.util.AppUtil.checkArgument; | ||
public class Remark { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to have one blank line before declare the class! (or because we will have JavaDocs comment here anyway)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, will add it soon
} | ||
|
||
@Override | ||
public int hashCode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice for you to override the hashCode!
@Test | ||
public void execute_filteredList_success() { | ||
showPersonAtIndex(model, INDEX_FIRST_PERSON); | ||
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed we have an opportunity to streamline our setup process across multiple tests. To make the test suite more maintainable and scalable, one suggestion is to create an abstract BaseTest class that includes all the common setup code in a @beforeeach method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work overall! Just some nitpicks here and there that's mostly related to style.
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra empty lines
import java.util.HashSet; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import java.util.*; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.Objects; | |
import java.util.Set; |
Replace wildcard import with more explicit import
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.person.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import seedu.address.model.person.*; | |
import seedu.address.model.person.Address; | |
import seedu.address.model.person.Email; | |
import seedu.address.model.person.Name; | |
import seedu.address.model.person.Person; | |
import seedu.address.model.person.Phone; |
Replace wildcard import with more explicit import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wildcard has been replaced, thank you!
} | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
Add EOF
@@ -28,21 +29,24 @@ class JsonAdaptedPerson { | |||
private final String phone; | |||
private final String email; | |||
private final String address; | |||
private final List<JsonAdaptedTag> tags = new ArrayList<>(); | |||
private final String remark; | |||
private final List<JsonAdaptedTag> tagged = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would retain tags
instead of renaming the variable to tagged
since we are referring to a list of tags. tagged
doesn't quite imply list of tags - I would infer it to be a boolean
variable (although isTag
better implies boolean
i know)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I agree with your reasoning. I changed it because I thought the past sense made more sense, but I shall revert this change, thanks!
public void execute_deleteRemarkUnfilteredList_success() { | ||
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); | ||
Person editedPerson = new PersonBuilder(firstPerson).withRemark("").build(); | ||
RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON, | ||
new Remark(editedPerson.getRemark().toString())); | ||
String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS, | ||
Messages.format(editedPerson)); | ||
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); | ||
expectedModel.setPerson(firstPerson, editedPerson); | ||
assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public void execute_deleteRemarkUnfilteredList_success() { | |
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); | |
Person editedPerson = new PersonBuilder(firstPerson).withRemark("").build(); | |
RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON, | |
new Remark(editedPerson.getRemark().toString())); | |
String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS, | |
Messages.format(editedPerson)); | |
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); | |
expectedModel.setPerson(firstPerson, editedPerson); | |
assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel); | |
public void execute_deleteRemarkUnfilteredList_success() { | |
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); | |
Person editedPerson = new PersonBuilder(firstPerson).withRemark("").build(); | |
RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON, | |
new Remark(editedPerson.getRemark().toString())); | |
String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS, | |
Messages.format(editedPerson)); | |
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); | |
expectedModel.setPerson(firstPerson, editedPerson); | |
assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel); |
Add new lines for better readability
@Test | ||
public void execute_filteredList_success() { | ||
showPersonAtIndex(model, INDEX_FIRST_PERSON); | ||
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed in favor of #32, due to a branch renaming from
AgentAssist-RemarkCommand-Dev
totutorial-adding-command
.