Skip to content

Commit

Permalink
set lastModified in ImmutableSearchResultBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
  • Loading branch information
dguggemos committed May 16, 2022
1 parent 207a829 commit 5ac9957
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -109,7 +109,7 @@ public SearchResultBuilder remove(final JsonValue value) {
@Override
public SearchResult build() {
final JsonArray searchResultsJsonArray = jsonArrayBuilder.build();
return ImmutableSearchResult.of(searchResultsJsonArray, offset, cursor, null);
return ImmutableSearchResult.of(searchResultsJsonArray, offset, cursor, lastModified);
}

}
Expand Up @@ -14,6 +14,8 @@

import static org.eclipse.ditto.thingsearch.model.assertions.DittoSearchAssertions.assertThat;

import java.time.Instant;

import org.eclipse.ditto.json.JsonArray;
import org.eclipse.ditto.json.JsonFactory;
import org.junit.Before;
Expand Down Expand Up @@ -112,6 +114,14 @@ public void setNextPageOffset() {
.isEmpty();
}

@Test
public void setLastModified() {
final Instant expectedLastModified = Instant.now();
final SearchResult searchResult = underTest.lastModified(expectedLastModified).build();

assertThat(searchResult.getLastModified()).contains(expectedLastModified);
}

@Test(expected = NullPointerException.class)
public void tryToAddAllNull() {
ImmutableSearchResultBuilder.newInstance()
Expand Down

0 comments on commit 5ac9957

Please sign in to comment.