AccountResource { @PUT @Path("gcm") @ApiOperation(value = "Update GCM account for authenticated user", response = Response.class, authorizations = {@Authorization(value = "authorization")}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful retrieval of created GCMAccount."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Consumes(MediaType.APPLICATION_JSON) public Response setGCMAccount( @ApiParam(required = true, value = "GCM account to set") GCMAccountDTO data) throws EntityAlreadyExistsException, EntityNotFoundException, CreationException { accountManager.setGCMAccount(data.getGcmId()); return Response.noContent().build(); } AccountResource(); @PostConstruct void init(); @GET @Path("/me") @ApiOperation(value = "Get authenticated user's account", response = AccountDTO.class, authorizations = {@Authorization(value = "authorization")}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of AccountDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) AccountDTO getAccount(); @PUT @Path("/me") @ApiOperation(value = "Update user's account", response = AccountDTO.class, authorizations = {@Authorization(value = "authorization")}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of updated AccountDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Response updateAccount(
            @ApiParam(hidden = true) @HeaderParam("Authorization") String authorizationString,
            @ApiParam(required = true, value = "Updated account") AccountDTO accountDTO); @POST @Path("/create") @ApiOperation(value = "Create a new account", response = AccountDTO.class, authorizations = {}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of created AccountDTO. Response will contain authentication token."), @ApiResponse(code = 202, message = "Account creation successful, but not yet enabled"), @ApiResponse(code = 400, message = "Bad request, read response message for more details"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) Response createAccount(
            @Context HttpServletRequest request,
            @Context HttpServletResponse response,
            @ApiParam(required = true, value = "Account to create") AccountDTO accountDTO); @GET @Path("/workspaces") @ApiOperation(value = "Get workspaces where authenticated user is active", response = WorkspaceDTO.class, responseContainer = "List", authorizations = {@Authorization(value = "authorization")}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of Workspaces. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) Response getWorkspaces(); @PUT @Path("gcm") @ApiOperation(value = "Update GCM account for authenticated user", response = Response.class, authorizations = {@Authorization(value = "authorization")}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful retrieval of created GCMAccount."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Consumes(MediaType.APPLICATION_JSON) Response setGCMAccount(
            @ApiParam(required = true, value = "GCM account to set") GCMAccountDTO data); @DELETE @Path("gcm") @ApiOperation(value = "Update GCM account for authenticated user", response = Response.class, authorizations = {@Authorization(value = "authorization")}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful delete of GCMAccount"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) Response deleteGCMAccount();  }
@Test public void setGCMAccountTest() throws ApplicationException { GCMAccountDTO data = new GCMAccountDTO(); Response response = accountResource.setGCMAccount(data); Mockito.doNothing().when(accountManager).setGCMAccount(data.getGcmId()); Assert.assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); }