@Test public void testCreateResource() { Sample r = new Sample("toto"); Response response = this.request("service-based").xmlPost(r); r = (Sample) response.resource(r.getClass()); Assertions.assertThat(r).isNotNull(); Assertions.assertThat(r.getName()).isEqualTo("toto"); }
@Test public void testFindPaginatedResources() { this.request("repository-based").xmlPost(new Sample("toto")); this.request("repository-based").xmlPost(new Sample("titi")); Response response = this.request("repository-based").setQueryParameter("page", "1").getXml(); Page<Sample> samples = response.resource(new TypeReference<Page<Sample>>() {}); Assertions.assertThat(samples).isNotNull(); Assertions.assertThat(samples.getContent()).isNotNull(); Assertions.assertThat(samples.getContent().size()).isEqualTo(2); Assertions.assertThat(samples.getTotalPages()).isEqualTo(1); Assertions.assertThat(samples.getTotalElements()).isEqualTo(2); Assertions.assertThat(samples.getContent().get(0).getName()).isIn("titi", "toto"); Assertions.assertThat(samples.getContent().get(1).getName()).isIn("titi", "toto"); }