Repository navigation
Add check for null value of serviceCodesRunning in TripPatternForDateMapper - #5239
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5239 +/- ##
=============================================
+ Coverage 65.70% 65.71% +0.01%
- Complexity 14725 14732 +7
=============================================
Files 1770 1770
Lines 68556 68583 +27
Branches 7288 7284 -4
=============================================
+ Hits 45044 45071 +27
- Misses 21016 21022 +6
+ Partials 2496 2490 -6
☔ View full report in Codecov by Sentry. |
|
|
||
| // ServiceCodesRunning is potentially null if the date is not present in the original GTFS. | ||
| // At that point we can simply return null, as there are no trips running on that date. | ||
| if (serviceCodesRunning == null) { |
There was a problem hiding this comment.
This looks ok, but can you please add a test for this code?
There was a problem hiding this comment.
If you're not sure how to do it, get in touch and I can help.
There was a problem hiding this comment.
I've added a test for my new addition, and also for the whole class as a whole, as it wasn't tested at all before.
…added tests for this class in TripPatternForDateMapperTest.java.
|
The test looks good but we want to move away from complex test setups that "build the world". I've taken the liberty to simplify yours: leonardehrenfried@5bcd5cd If you're ok with this, can you pull it into your branch? |
|
Since we just spoke, here is a reminder to pull my code into your branch. |
…lid-serviceOnDate Simplify test test setup
Summary
Fixes an issue where an NullPointer could be thrown while mapping trip patterns for invalid dates.
This is fixed by checking if the serviceCodesRunning set is not null before trying to check if it includes the current trips' service code.
Issue
Closes #5238
Unit tests
New unit tests were added for the TripPatternForDateMapper.
Manual verification was done with the given files in #5238 and debugging in IntelliJ, to see if the issue has been solved.
Documentation
Comments were added where needed.