UserResource { @DELETE @ApiOperation(value = "Delete tag subscription of user", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful deletion of TagSubscriptionDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{login}/tag-subscriptions/{tagName}") @Produces(MediaType.APPLICATION_JSON) public Response deleteUserSubscription( @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId, @ApiParam(required = true, value = "User login") @PathParam("login") String login, @ApiParam(required = true, value = "Tag name") @PathParam("tagName") String tagName) throws EntityNotFoundException, AccessRightException, UserNotActiveException, WorkspaceNotEnabledException { notificationManager.removeTagUserSubscription(workspaceId, login, tagName); return Response.noContent().build(); } UserResource(); @PostConstruct void init(); @GET @ApiOperation(value = "Get users in workspace", response = UserDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of UserDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) UserDTO[] getUsersInWorkspace(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get authenticated user details", response = UserDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of UserDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("me") @Produces(MediaType.APPLICATION_JSON) UserDTO whoAmI(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get admin for workspace", response = UserDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of UserDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("admin") @Produces(MediaType.APPLICATION_JSON) UserDTO getAdminInWorkspace(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get tag subscriptions of user", response = TagSubscriptionDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of TagSubscriptionDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{login}/tag-subscriptions") @Produces(MediaType.APPLICATION_JSON) TagSubscriptionDTO[] getTagSubscriptionsForUser(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
            @ApiParam(required = true, value = "User login") @PathParam("login") String login); @PUT @ApiOperation(value = "Update or create tag subscription of user", response = TagSubscriptionDTO.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "Successful retrieval of created/updated TagSubscriptionDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{login}/tag-subscriptions/{tagName}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Response updateUserSubscription(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
            @ApiParam(required = true, value = "User login") @PathParam("login") String login,
            @ApiParam(required = true, value = "Tag name") @PathParam("tagName") String tagName,
            @ApiParam(required = true, value = "Tag subscription to update or create") TagSubscriptionDTO subDTO); @DELETE @ApiOperation(value = "Delete tag subscription of user", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful deletion of TagSubscriptionDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("{login}/tag-subscriptions/{tagName}") @Produces(MediaType.APPLICATION_JSON) Response deleteUserSubscription(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
            @ApiParam(required = true, value = "User login") @PathParam("login") String login,
            @ApiParam(required = true, value = "Tag name") @PathParam("tagName") String tagName);  }
@Test public void deleteUserSubscriptionTest() throws ApplicationException { String tagName = "blah"; Response res = userResource.deleteUserSubscription(workspaceId, login, tagName); Mockito.verify(notificationManager, Mockito.times(1)) .removeTagUserSubscription(workspaceId, login, tagName); Assert.assertEquals(Response.Status.NO_CONTENT.getStatusCode(), res.getStatus()); }