GlobalPropertyResource { @GET @Timed @UnitOfWork(transactional = false) @ApiOperation(value = "Search global property based on name, param", response = Set.class) public Response search(@QueryParam("name") final String name, @QueryParam("type") final String propertyType) { return Response.ok().entity(service.search(name, propertyType)).build(); }  @POST @Consumes(MediaType.APPLICATION_JSON) @Timed @UnitOfWork @ApiOperation(value = "Save global property", response = GlobalPropertyDomain.class) Response save(@NotNull @Valid final GlobalPropertyDomain globalProperty); @GET @Timed @UnitOfWork(transactional = false) @Path("{id}") @ApiOperation(value = "Get global property by id", response = GlobalPropertyDomain.class) Response get(@PathParam("id") final int id); @GET @Timed @UnitOfWork(transactional = false) @ApiOperation(value = "Search global property based on name, param", response = Set.class) Response search(@QueryParam("name") final String name, @QueryParam("type") final String propertyType); @DELETE @Timed @UnitOfWork @Path("{id}") @ApiOperation(value = "Soft delete") Response delete(@PathParam("id") final int id);  }
@Test public void testSearch() { doReturn(ImmutableSet.of(globalProperty)).when(service).search(anyString(), anyString()); final Response response = resource.search(globalProperty.getName(), globalProperty.getType()); Assert.assertEquals(response.getStatus(), 200); Assert.assertEquals(response.getEntity(), ImmutableSet.of(globalProperty)); }