Beispiel #1
0
  @Test
  public void getNextPage_returnsFullNextPage_whenItIsNotAFullFirstPage() throws Exception {
    final Page page = new Page(3, 5);

    final Page nextPage = page.getPreviousPage().getNextPage();

    assertThat(nextPage).isNotNull();
    assertThat(nextPage.getStart()).isEqualTo(3);
    assertThat(nextPage.getSize()).isEqualTo(5);
  }
Beispiel #2
0
  @Test
  public void getPreviousPage_returnsEmptyPage_whenItIsAlreadyEmptyPage() throws Exception {
    final Page page = new Page(0, 5);

    final Page previousPage = page.getPreviousPage().getPreviousPage();

    assertThat(previousPage).isNotNull();
    assertThat(previousPage.getStart()).isEqualTo(0);
    assertThat(previousPage.getSize()).isEqualTo(0);
  }
Beispiel #3
0
  @Test
  public void getNextPage_returnsNextPage_whenItIsAFirstPage() throws Exception {
    final Page page = new Page(0, 5);

    final Page nextPage = page.getNextPage();

    assertThat(nextPage).isNotNull();
    assertThat(nextPage.getStart()).isEqualTo(5);
    assertThat(nextPage.getSize()).isEqualTo(5);
  }
Beispiel #4
0
  @Test
  public void getPreviousPage_returnsFullPreviousPage_whenThereAreEnoughSize() throws Exception {
    final Page page = new Page(5, 5);

    final Page previousPage = page.getPreviousPage();

    assertThat(previousPage).isNotNull();
    assertThat(previousPage.getStart()).isEqualTo(0);
    assertThat(previousPage.getSize()).isEqualTo(5);
  }