Skip to content

Commit f197035

Browse files
committed
Fix Assertions for Special Implementation of UserProfileService
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent f0f6fad commit f197035

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/test/java/io/securecodebox/persistence/defectdojo/service/UserProfileServiceTest.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.fasterxml.jackson.core.JsonProcessingException;
88
import io.securecodebox.persistence.defectdojo.model.User;
99
import io.securecodebox.persistence.defectdojo.model.UserProfile;
10-
import org.junit.jupiter.api.Disabled;
1110
import org.junit.jupiter.api.Test;
1211

1312
import java.io.IOException;
@@ -114,9 +113,7 @@ void get_byId() {
114113
assertThat(result, is(expected));
115114
}
116115

117-
118116
@Test
119-
@Disabled("FIXME: Does not return empty optional.")
120117
void searchUnique_withSearchObject() throws URISyntaxException, JsonProcessingException {
121118
// Here we only test that the object properties are correctly mapped to get params,
122119
// since the response parsing and binding is covered by the other tests.
@@ -129,17 +126,21 @@ void searchUnique_withSearchObject() throws URISyntaxException, JsonProcessingEx
129126
.withBody(EMPTY_SEARCH_RESULT_RESPONSE_FIXTURE)
130127
));
131128

132-
final var searchObject = UserProfile.builder()
133-
// FIXME Add params!
134-
.build();
129+
// TODO: Here we should set some user to add it as search parameter, but this
130+
// leads to an exception in the deepness of the URI builder of the base service
131+
// implementation. I guess that our implementation can't deal with such nested models
132+
// as search object.
133+
final var searchObject = UserProfile.builder().build();
135134

136135
final var result = sut.searchUnique(searchObject);
137136

138-
assertThat(result.isEmpty(), is(true));
137+
assertAll(
138+
() -> assertThat(result.isEmpty(), is(false)),
139+
() -> assertThat(result.get().getUser(), is(nullValue()))
140+
);
139141
}
140142

141143
@Test
142-
@Disabled("FIXME: Does not return empty optional.")
143144
void searchUnique_withQueryParams() throws URISyntaxException, JsonProcessingException {
144145
// Here we only test that the object properties are correctly mapped to get params,
145146
// since the response parsing and binding is covered by the other tests.
@@ -159,7 +160,10 @@ void searchUnique_withQueryParams() throws URISyntaxException, JsonProcessingExc
159160

160161
final var result = sut.searchUnique(queryParams);
161162

162-
assertThat(result.isEmpty(), is(true));
163+
assertAll(
164+
() -> assertThat(result.isEmpty(), is(false)),
165+
() -> assertThat(result.get().getUser(), is(nullValue()))
166+
);
163167
}
164168

165169
@Test

0 commit comments

Comments
 (0)