Skip to content

Commit

Permalink
feat: update nosql to return true
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Jul 8, 2024
1 parent 676be96 commit c3fb28d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public int numberOfElements() {

@Override
public boolean hasNext() {
throw new UnsupportedOperationException("Eclipse JNoSQL has no support for this feature hasNext");
return true;
}

@Override
public boolean hasPrevious() {
throw new UnsupportedOperationException("Eclipse JNoSQL has no support for this feature hasPrevious");
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,26 @@ void shouldReturnUnsupportedOperation() {
PageRequest.ofPage(2));

assertThrows(UnsupportedOperationException.class, page::totalPages);

assertThrows(UnsupportedOperationException.class, page::totalElements);
assertThrows(UnsupportedOperationException.class, page::hasNext);
assertThrows(UnsupportedOperationException.class, page::hasPrevious);
assertThrows(UnsupportedOperationException.class, page::hasTotals);
}

@Test
void shouldReturnTrueHasNext(){
Page<Person> page = NoSQLPage.of(Collections.singletonList(Person.builder().withName("Otavio").build()),
PageRequest.ofPage(2));

org.assertj.core.api.Assertions.assertThat(page.hasNext()).isTrue();
}

@Test
void shouldReturnTrueHasPrevious(){
Page<Person> page = NoSQLPage.of(Collections.singletonList(Person.builder().withName("Otavio").build()),
PageRequest.ofPage(2));

org.assertj.core.api.Assertions.assertThat(page.hasPrevious()).isTrue();
}

@Test
void shouldReturnHasContent() {

Expand Down

0 comments on commit c3fb28d

Please sign in to comment.