Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageRequest toString wrongly states a cursor has multiple keys #683

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/src/main/java/jakarta/data/page/PageRequestCursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PageRequestCursor implements PageRequest.Cursor {
PageRequestCursor(Object... key) {
this.key = key;
if (key == null || key.length == 0)
throw new IllegalArgumentException("No key values were provided.");
throw new IllegalArgumentException("No values were provided.");
}

@Override
Expand Down Expand Up @@ -69,6 +69,6 @@ public List<?> elements() {
@Override
public String toString() {
return "Cursor@" + Integer.toHexString(hashCode()) +
" with " + key.length + " keys";
" with " + key.length + " values";
}
}
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/data/page/Pagination.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public String toString() {
.append(", size=").append(size)
.append(", mode=").append(mode);
if (type != null) {
s.append(", ").append(type.size()).append(" keys");
s.append(", cursor size=").append(type.size());
}
return s.append("}").toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ void shouldPageRequestDisplayAsString() {
assertSoftly(softly -> {

softly.assertThat(afterKeySet.toString())
.isEqualTo("PageRequest{page=1, size=200, mode=CURSOR_NEXT, 2 keys}");
.isEqualTo("PageRequest{page=1, size=200, mode=CURSOR_NEXT, cursor size=2}");

softly.assertThat(beforeKeySet.toString())
.isEqualTo("PageRequest{page=1, size=100, mode=CURSOR_PREVIOUS, 2 keys}");
.isEqualTo("PageRequest{page=1, size=100, mode=CURSOR_PREVIOUS, cursor size=2}");

});
}
Expand Down