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

[W6.4d][F09-B4]Zhong ZhengXin #731

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Godxin
Copy link

@Godxin Godxin commented Mar 1, 2018

Use Polymorphism [LO-Polymorphism]:

Exercise: Add a polymorphic isMutating method

Copy link

@k-l-a k-l-a left a 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
Copy link

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()) {
Copy link

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.

@k-l-a k-l-a added the Reviewed label Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants