11package org .rest .common .web .base ;
22
3+ import static com .jayway .restassured .RestAssured .get ;
34import static org .apache .commons .lang3 .RandomStringUtils .randomAlphabetic ;
45import static org .apache .commons .lang3 .RandomStringUtils .randomNumeric ;
56import static org .hamcrest .CoreMatchers .is ;
@@ -24,17 +25,17 @@ public abstract class AbstractPaginationRESTIntegrationTest<T extends IEntity> {
2425
2526 // tests
2627
27- // GET (paged )
28+ // GET (paginated )
2829
2930 @ Test
30- public final void whenResourcesAreRetrievedPaged_thenNoExceptions () {
31- givenAuthenticated ().get ( getURI () + "?page=1&size=1" );
31+ public final void whenResourcesAreRetrievedPaginated_thenNoExceptions () {
32+ getAPI ().findAllPaginatedAsResponse ( 1 , 1 );
3233 }
3334
3435 @ Test
35- public final void whenResourcesAreRetrievedPaged_then200IsReceived () {
36+ public final void whenResourcesAreRetrievedPaginated_then200IsReceived () {
3637 // When
37- final Response response = givenAuthenticated ().get ( getURI () + "?page=0&size=1" );
38+ final Response response = getAPI ().findAllPaginatedAsResponse ( 0 , 1 );
3839
3940 // Then
4041 assertThat (response .getStatusCode (), is (200 ));
@@ -45,7 +46,7 @@ public final void whenFirstPageOfResourcesAreRetrieved_thenResourcesPageIsReturn
4546 getAPI ().createAsResponse (getAPI ().createNewEntity ());
4647
4748 // When
48- final Response response = givenAuthenticated ().get ( getURI () + "?page=0&size=1" );
49+ final Response response = getAPI ().findAllPaginatedAsResponse ( 0 , 1 );
4950
5051 // Then
5152 assertFalse (getAPI ().getMarshaller ().decode (response .asString (), List .class ).isEmpty ());
@@ -54,7 +55,7 @@ public final void whenFirstPageOfResourcesAreRetrieved_thenResourcesPageIsReturn
5455 @ Test
5556 public final void whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived () {
5657 // When
57- final Response response = givenAuthenticated ().get ( getURI () + "?page=" + randomNumeric (5 ) + "&size=1" );
58+ final Response response = getAPI ().findAllPaginatedAsResponse ( Integer . parseInt ( randomNumeric (5 )), 1 );
5859
5960 // Then
6061 assertThat (response .getStatusCode (), is (404 ));
@@ -63,7 +64,7 @@ public final void whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived()
6364 @ Test
6465 public final void whenResourcesAreRetrievedWithNonNumericPage_then400IsReceived () {
6566 // When
66- final Response response = givenAuthenticated (). get (getURI () + "?page=" + randomAlphabetic (5 ).toLowerCase () + "&size=1" );
67+ final Response response = get (getURI () + "?page=" + randomAlphabetic (5 ).toLowerCase () + "&size=1" );
6768
6869 // Then
6970 assertThat (response .getStatusCode (), is (400 ));
@@ -72,7 +73,7 @@ public final void whenResourcesAreRetrievedWithNonNumericPage_then400IsReceived(
7273 @ Test
7374 public final void whenResourcesAreRetrievedWithNonNumericPageSize_then400IsReceived () {
7475 // When
75- final Response response = givenAuthenticated (). get (getURI () + "?page=0" + "&size=" + randomAlphabetic (5 ));
76+ final Response response = get (getURI () + "?page=0" + "&size=" + randomAlphabetic (5 ));
7677
7778 // Then
7879 assertThat (response .getStatusCode (), is (400 ));
0 commit comments