-
Notifications
You must be signed in to change notification settings - Fork 141
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
[W6.4d][F09-B4]Zhong ZhengXin #731
base: master
Are you sure you want to change the base?
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.
@Godxin Some comments added. Please close PR after reading.
|
||
public abstract boolean isMutating( ); | ||
/** | ||
* Checks whether the commands change the data |
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.
A more precise phrasing would be Returns true if.....
It is better to mention that it returns true if the command potentially changes the data. Try to be as precise as possible.
@@ -90,7 +91,10 @@ private void assertCommandBehavior(String inputCommand, | |||
//Confirm the state of data is as expected | |||
assertEquals(expectedAddressBook, addressBook); | |||
assertEquals(lastShownList, logic.getLastShownList()); | |||
assertEquals(addressBook, saveFile.load()); | |||
if(new Parser().parseCommand(inputCommand).isMutating()) { |
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.
This change does not help as it does not confirm that saving happens only on mutating commands. Tests will pass even without this change. To be more complete, you should have an else branch to confirm that saving does not happen if the command is non mutating.
Use Polymorphism [LO-Polymorphism]:
Exercise: Add a polymorphic isMutating method