Exemplo n.º 1
0
  @Test
  public void getAllTripssMiddlePageTest() throws Exception {
    Page<Trip> users = SERVICE.getAllTrips(2, 5);
    assertTrue(users.hasContent());
    assertEquals(5, users.getNumberOfElements());

    PageInfo pi = users.getPageInfo();
    assertEquals(2, pi.getPageNumber());
    assertEquals(5, pi.getPageSize());
    assertEquals(17, pi.getTotalElements());
    assertEquals(4, pi.getTotalPages());
    assertTrue(pi.hasNextPage());
    assertTrue(pi.hasPreviousPage());
  }
Exemplo n.º 2
0
  @Test
  public void getAllNonRemovedUsersFirstPageTest() throws Exception {
    Page<Trip> users = SERVICE.getAllNonRemovedTrips(1, 5);
    assertTrue(users.hasContent());
    assertEquals(5, users.getNumberOfElements());

    PageInfo pi = users.getPageInfo();
    assertEquals(1, pi.getPageNumber());
    assertEquals(5, pi.getPageSize());
    assertEquals(13, pi.getTotalElements());
    assertEquals(3, pi.getTotalPages());
    assertTrue(pi.hasNextPage());
    assertFalse(pi.hasPreviousPage());
  }
Exemplo n.º 3
0
  @Test
  public void getAllTripsFirstPageTest() throws Exception {
    Page<Trip> users = SERVICE.getAllTrips(1, 5);
    assertTrue(users.hasContent());
    assertEquals(5, users.getNumberOfElements());

    PageInfo pi = users.getPageInfo();
    assertEquals(1, pi.getPageNumber());
    assertEquals(5, pi.getPageSize());
    assertEquals(17, pi.getTotalElements());
    assertEquals(4, pi.getTotalPages());
    assertTrue(pi.hasNextPage());
    assertFalse(pi.hasPreviousPage());

    List<Trip> content = users.getContent();
    assertEquals("Dunaj", content.get(0).getTitle());
    assertEquals("Plezanje - Kotečnik", content.get(4).getTitle());
  }