Skip to content

Commit 78bcbba

Browse files
committed
#23 Add Identical Behaviour Likethe Others Implementations Have
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent dd84156 commit 78bcbba

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/main/java/io/securecodebox/persistence/defectdojo/model/UserProfile.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ public final class UserProfile implements Model {
2323

2424
@Override
2525
public boolean equalsQueryString(Map<String, Object> queryParams) {
26+
if (QueryParamsComparator.isNull(queryParams)) {
27+
return false;
28+
}
29+
2630
// The user_profile endpoint does not have query parameters that's
2731
// why this function will just return true.
28-
// TODO: All other implementations return false if null is given for queryParams.
29-
// We should consider to change this API according to that.
3032
return true;
3133
}
3234

src/test/java/io/securecodebox/persistence/defectdojo/model/UserProfileTest.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ void equalsAndHashCode() {
2222
}
2323

2424
@Test
25-
void equalsQueryString_alwaysTrue() {
25+
void equalsQueryString_alwaysTrueIfNotNullGiven() {
2626
final var sut = UserProfile.builder()
2727
.build();
2828

29-
assertThat(sut.equalsQueryString(null), is(true));
3029
assertThat(sut.equalsQueryString(Collections.emptyMap()), is(true));
3130
}
31+
32+
@Test
33+
void equalsQueryString_alwaysFalseIfNull() {
34+
final var sut = UserProfile.builder()
35+
.build();
36+
37+
assertThat(sut.equalsQueryString(null), is(false));
38+
}
3239
}

0 commit comments

Comments
 (0)