@@ -89,4 +89,21 @@ final class Unpaged implements Pageable {
|
||||
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Unpaged unpaged)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return sort.equals(unpaged.sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return sort.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,11 @@ class PageRequestUnitTests extends AbstractPageRequestUnitTests {
|
||||
|
||||
// Is not equal to instance with another sort
|
||||
assertNotEqualsAndHashcode(request, PageRequest.of(1, 10, Direction.ASC, "foo"));
|
||||
|
||||
// Equaliity for unpaged
|
||||
assertEqualsAndHashcode(Pageable.unpaged(), Pageable.unpaged(Sort.unsorted()));
|
||||
|
||||
assertNotEqualsAndHashcode(Pageable.unpaged(), Pageable.unpaged(Sort.by("foo")));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1581
|
||||
|
||||
Reference in New Issue
Block a user