ResourceSpeaker { @PUT @Path("/search") public Set<Speaker> search(final Speaker speaker) { final Set<Speaker> speakers = this.speakerDAO.find(speaker); speakers.forEach(this::addHyperMedia); return speakers; }  @GET Collection<Speaker> retrieveAll(); @GET @Path("/nessProbe") @Produces(MediaType.TEXT_PLAIN) Response nessProbe(); @POST @Path("/add") Speaker add(final Speaker speaker); @DELETE @Path("/remove/{id}") void remove(@PathParam("id") final String id); @PUT @Path("/update") Speaker update(final Speaker speaker); @GET @Path("/retrieve/{id}") Speaker retrieve(@PathParam("id") final String id); @PUT @Path("/search") Set<Speaker> search(final Speaker speaker);  }
@Test @RunAsClient public void testSearch() { final Speaker search = new Speaker(); search.setNameFirst("Ar"); search.setNameLast("G"); final Set<Speaker> speakers = this.getWebTarget("speaker/search").request(MediaType.APPLICATION_JSON_TYPE) .put(Entity.json(search)) .readEntity(new GenericType<Set<Speaker>>() { }); Assert.assertFalse(speakers.isEmpty()); boolean foundArun = false; for (final Speaker speaker : speakers) { this.log.info("Found: " + speaker.getNameFirst() + " " + speaker.getNameLast()); if ("Arun".equals(speaker.getNameFirst()) && "Gupta".equals(speaker.getNameLast())) { foundArun = true; } } Assert.assertTrue(foundArun); }