Skip to content

Commit 027d57c

Browse files
author
eugenp
committed
- work on pagination
1 parent 2cf4ee5 commit 027d57c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/test/java/org/rest/web/common/AbstractPaginationRESTIntegrationTest.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.rest.web.common;
22

3+
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
34
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
45
import static org.hamcrest.CoreMatchers.is;
56
import static org.hamcrest.MatcherAssert.assertThat;
@@ -54,6 +55,23 @@ public final void whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived()
5455
assertThat( response.getStatusCode(), is( 404 ) );
5556
}
5657

58+
@Test
59+
public final void whenResourcesAreRetrievedWithNonNumericPage_then400IsReceived(){
60+
// When
61+
final Response response = givenAuthenticated().get( getURI() + "?page=" + randomAlphabetic( 5 ).toLowerCase() + "&size=1" );
62+
63+
// Then
64+
assertThat( response.getStatusCode(), is( 400 ) );
65+
}
66+
@Test
67+
public final void whenResourcesAreRetrievedWithNonNumericPageSize_then400IsReceived(){
68+
// When
69+
final Response response = givenAuthenticated().get( getURI() + "?page=0" + "&size=" + randomAlphabetic( 5 ) );
70+
71+
// Then
72+
assertThat( response.getStatusCode(), is( 400 ) );
73+
}
74+
5775
// util
5876

5977
protected final RequestSpecification givenAuthenticated(){

0 commit comments

Comments
 (0)