Skip to content

Commit

Permalink
#23 Also return false if id value in query params is null
Browse files Browse the repository at this point in the history
Since the implementation of isNameEqual returns false, if the
value in the map is null, we do this for id the same way to be
consistent.

Signed-off-by: Sven Strittmatter <[email protected]>
  • Loading branch information
Weltraumschaf committed Jan 26, 2024
1 parent cb75f1f commit 36b1e8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ static boolean isIdEqual(HasId model, Map<String, Object> queryParams) {
return false;
}

// FIXME: Since th generic type for value is Object, possible NPE here!
if (isNull(queryParams.get(QUERY_PARAM_KEY_FOR_ID))) {
return false;
}

return queryParams.get(QUERY_PARAM_KEY_FOR_ID).equals(model.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void isIdEqual_falseIfQueryParamsDoesNotContainId() {
}

@Test
@Disabled("Unclear if this behaviour will break something.")
void isIdEqual_falseIfQueryParamValueIsNull() {
final var queryParams = new HashMap<String, Object>();
queryParams.put(QueryParamsComparator.QUERY_PARAM_KEY_FOR_ID, null);
Expand Down

0 comments on commit 36b1e8b

Please sign in to comment.