ImagesResource { @POST @Consumes(APPLICATION_JSON) public Response saveImages(List<Image> images) { imagesService.addImages(images); return ok(); } @Autowired  ImagesResource(ImagesService imagesService); @GET @Path("/{imageId}") Response getImageById(@PathParam("imageId") String imageId); @POST @Consumes(APPLICATION_JSON) Response saveImages(List<Image> images); @POST @Path("/delete") @Consumes(APPLICATION_JSON) Response deleteImages(List<String> imageIds);  }
@Test public void testSaveImages() throws Exception { List<Image> images = new ArrayList<>(); Image image = EntityGenerator.getImage(); image.setId("another-id"); images.add(image); assertThat(imagesAware.getImages(), hasSize(1)); Response<ResponseBody> response = getApi().add(images).execute(); assertThat(response.isSuccessful(), is(true)); assertThat(imagesAware.getImages(), hasSize(2)); }