-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix id reference of visits #138
Fix id reference of visits #138
Conversation
Codecov Report
@@ Coverage Diff @@
## master #138 +/- ##
============================================
+ Coverage 74.83% 74.88% +0.04%
- Complexity 765 767 +2
============================================
Files 111 111
Lines 2281 2293 +12
Branches 269 272 +3
============================================
+ Hits 1707 1717 +10
Misses 508 508
- Partials 66 68 +2
Continue to review full report at Codecov.
|
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.
Changes requested, certain tests need to be added as mentioned.
Also, are there tests to test if the issue of adding the wrong index has been solved? Having a test which tests if the same visit is added based on what the viewer sees should be added if it does not exist yet.
@@ -21,7 +27,7 @@ | |||
public class AddVisitCommandTest { | |||
@Test | |||
public void constructor_nullLocation_throwsNullPointerException() { | |||
assertThrows(NullPointerException.class, () -> new AddVisitCommand(null)); | |||
assertThrows(NullPointerException.class, () -> new AddVisitCommand(null, null, null)); |
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.
Now that there are three parameters for the constructors, perhaps it could be better if each parameter is tested for NullPointerException in a separate 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.
Have added additional assertions.
@@ -21,7 +27,7 @@ | |||
public class AddVisitCommandTest { | |||
@Test | |||
public void constructor_nullLocation_throwsNullPointerException() { |
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.
Typo here. Shouldn't be nullLocation but instead the parameter that is null in this 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.
Have changed the method name
requireAllNonNull(visit); | ||
toAdd = visit; | ||
public AddVisitCommand(Index personIndex, Index locationIndex, LocalDate date) { | ||
requireAllNonNull(personIndex, locationIndex); |
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.
Shouldn't date be required to be non null as well?
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 catch! I have updated it.
Additional tests to confirm the success of adding the correct visits are added under filtered and unfiltered lists.
…hopinxian/tp into v1.2/branch-FixVisitIdReference
Thanks for the review. I have improved the Pull Request according to your comments. |
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.
Almost done! I think one test case just needs a little bit of tweaking.
Implement a fix that ensures id of person and location that visit is referring to matches the intended person and location.
Fix #136