-
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
Refactor Complete Command code #216
Refactor Complete Command code #216
Conversation
Previously, a Complete command descriptor was used to check if user update by date or index. As such, multiple null checks were made Update Complete Command to have subclasses that will execute differently if user input index or date This cleans up code and removes the needs for multiple null checks
Codecov Report
@@ Coverage Diff @@
## master #216 +/- ##
============================================
+ Coverage 75.68% 75.82% +0.14%
- Complexity 667 671 +4
============================================
Files 101 103 +2
Lines 2155 2147 -8
Branches 228 222 -6
============================================
- Hits 1631 1628 -3
+ Misses 461 459 -2
+ Partials 63 60 -3
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
public void testCompleteByIndexSubclass() { | ||
//valid Index | ||
Person editedPerson = new PersonBuilder(BENSON).withNullAppointment().build(); | ||
String expectedMessage = MESSAGE_COMPLETE_SUCCESS; | ||
CompleteDescriptor completeDescriptor = new CompleteDescriptor(); | ||
completeDescriptor.setIndex(INDEX_SECOND_PERSON); | ||
CompleteCommand completeCommand = new CompleteCommand(completeDescriptor); | ||
|
||
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); | ||
expectedModel.setPerson(model.getFilteredPersonList().get(1), editedPerson); | ||
|
||
CompleteCommand completeCommand = new CompleteByIndex(INDEX_SECOND_PERSON); | ||
|
||
assertCommandSuccess(completeCommand, 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.
Not sure if this correct method of doing integration testing for subclasses
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.
LGTM
Previously, a Complete command descriptor was used to check if user update by date or index. As such, multiple null checks were made
Update Complete Command to have subclasses that will execute differently if user input index or date
This cleans up code and removes the needs for multiple null checks