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

Refactor Complete Command code #216

Conversation

Kb-Tay
Copy link
Collaborator

@Kb-Tay Kb-Tay commented Nov 7, 2023

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

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
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #216 (9109f9a) into master (d7a9c96) will increase coverage by 0.14%.
Report is 2 commits behind head on master.
The diff coverage is 95.74%.

@@             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     
Files Coverage Δ
...a/seedu/address/logic/commands/CompleteByDate.java 100.00% <100.00%> (ø)
.../seedu/address/logic/commands/CompleteCommand.java 100.00% <100.00%> (+15.55%) ⬆️
...du/address/logic/parser/CompleteCommandParser.java 100.00% <100.00%> (ø)
.../seedu/address/logic/commands/CompleteByIndex.java 90.00% <90.00%> (ø)

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

Comment on lines +30 to 40
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);
Copy link
Collaborator Author

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

@Kb-Tay Kb-Tay added this to the v1.4 milestone Nov 7, 2023
@Kb-Tay Kb-Tay added the enhancement New feature or request label Nov 7, 2023
Copy link
Collaborator

@sopa301 sopa301 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sopa301 sopa301 merged commit 2dc919f into AY2324S1-CS2103T-F12-1:master Nov 7, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants