-
Notifications
You must be signed in to change notification settings - Fork 695
fix null handling for id in query by example #2471
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2471 +/- ##
============================================
- Coverage 81.29% 74.16% -7.14%
+ Complexity 2343 2150 -193
============================================
Files 264 267 +3
Lines 7663 7722 +59
Branches 790 798 +8
============================================
- Hits 6230 5727 -503
- Misses 1097 1625 +528
- Partials 336 370 +34
Flags with carried forward coverage won't be shown. Click here to find out more. 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.
I love the refactoring and the new comments. So much more intuitive!
Just a couple of minor comments.
filters.add(StructuredQuery.PropertyFilter.eq(fieldName, value)); | ||
if (notIgnoredProperty(example, persistentProperty)) { | ||
Value<?> value = getValue(example, probeEntity, persistentEntity, persistentProperty); | ||
NullHandler nullHandler = example.getMatcher().getNullHandler(); |
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.
So the check for value instanceof NullValue
is not needed?
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.
It is still required. NullHandler just indicates if we need to include null valued fields or not, and value instanceof NullValue
is a check to see if a field holds a null value.
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.
Oh, it's in addFilter now. I missed it.
return value; | ||
} | ||
|
||
private <T> boolean notIgnoredProperty(Example<T> example, DatastorePersistentProperty persistentProperty) { |
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.
It may be easier to read as isIgnoredProperty()
, removing the negation here and putting the negation in getDatastoreReadWriter()
method instead. Our brains are very used to the isBlah
pattern.
SonarCloud Quality Gate failed. 0 Bugs 65.5% Coverage The version of Java (1.8.0_151) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11. |
fixes #2470