1111import java .io .InputStream ;
1212
1313import static com .gooddata .JsonMatchers .serializesToJson ;
14+ import static com .gooddata .util .ResourceUtils .readObjectFromResource ;
1415import static org .hamcrest .CoreMatchers .notNullValue ;
1516import static org .hamcrest .CoreMatchers .nullValue ;
1617import static org .hamcrest .MatcherAssert .assertThat ;
@@ -20,8 +21,7 @@ public class PagingTest {
2021
2122 @ Test
2223 public void testDeserialization () throws Exception {
23- final InputStream stream = getClass ().getResourceAsStream ("/collections/paging.json" );
24- final Paging paging = new ObjectMapper ().readValue (stream , Paging .class );
24+ final Paging paging = readObjectFromResource ("/collections/paging.json" , Paging .class );
2525
2626 assertThat (paging .getOffset (), is ("0" ));
2727 assertThat (paging .getNext (), notNullValue ());
@@ -30,17 +30,15 @@ public void testDeserialization() throws Exception {
3030
3131 @ Test
3232 public void testDeserializationNullNext () throws Exception {
33- final InputStream stream = getClass ().getResourceAsStream ("/collections/paging_no_next.json" );
34- final Paging paging = new ObjectMapper ().readValue (stream , Paging .class );
33+ final Paging paging = readObjectFromResource ("/collections/paging_no_next.json" , Paging .class );
3534
3635 assertThat (paging .getOffset (), is ("0" ));
3736 assertThat (paging .getNext (), nullValue ());
3837 }
3938
4039 @ Test
4140 public void testDeserializationWithNextOnly () throws Exception {
42- final InputStream stream = getClass ().getResourceAsStream ("/collections/paging_only_next.json" );
43- final Paging paging = new ObjectMapper ().readValue (stream , Paging .class );
41+ final Paging paging = readObjectFromResource ("/collections/paging_only_next.json" , Paging .class );
4442
4543 assertThat (paging .getOffset (), is (nullValue ()));
4644 assertThat (paging .getNext (), notNullValue ());
0 commit comments