OrganizationResource { @DELETE @ApiOperation(value = "Delete authenticated user's organization", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful deletion of OrganizationDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) public Response deleteOrganization() throws EntityNotFoundException, AccessRightException { Organization organization = organizationManager.getMyOrganization(); organizationManager.deleteOrganization(organization.getName()); return Response.noContent().build(); } OrganizationResource(); @PostConstruct void init(); @GET @ApiOperation(value = "Get organization for authenticated user", response = OrganizationDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of OrganizationDTO. It may be a null object"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) OrganizationDTO getOrganization(); @POST @ApiOperation(value = "Create authenticated user's organization", response = OrganizationDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of created OrganizationDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) OrganizationDTO createOrganization(
            @ApiParam(required = true, value = "Organization to create") OrganizationDTO organizationDTO); @PUT @ApiOperation(value = "Update authenticated user's organization", response = OrganizationDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of updated OrganizationDTO"), @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) OrganizationDTO updateOrganization(
            @ApiParam(required = true, value = "Updated organization") OrganizationDTO organizationDTO); @DELETE @ApiOperation(value = "Delete authenticated user's organization", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful deletion of OrganizationDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) Response deleteOrganization(); @GET @Path("members") @ApiOperation(value = "Get members of the authenticated user's organization", response = AccountDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of AccountDTOs. 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) Response getMembers(); @PUT @Path("add-member") @ApiOperation(value = "Add a member to the authenticated user's organization", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful member add operation"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) Response addMember(
            @ApiParam(required = true, value = "User to add") UserDTO userDTO); @PUT @Path("remove-member") @ApiOperation(value = "Remove a member to the authenticated user's organization", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful member removal operation"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) Response removeMember(
            @ApiParam(required = true, value = "User to remove") UserDTO userDTO); @PUT @Path("move-member") @ApiOperation(value = "Move a member up or down in the authenticated user's organization", response = Response.class) @ApiResponses(value = { @ApiResponse(code = 204, message = "Successful member moved operation"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Produces(MediaType.APPLICATION_JSON) Response moveMember(
            @ApiParam(required = true, value = "User to move up") UserDTO userDTO,
            @ApiParam(required = true, value = "Direction (up/down)") @QueryParam("direction") String direction);  }
@Test public void deleteOrganizationTest() throws EntityNotFoundException, AccessRightException { Mockito.when(organizationManager.getMyOrganization()).thenReturn(organization); Mockito.doNothing().when(organizationManager).deleteOrganization(organization.getName()); Response response = organizationResource.deleteOrganization(); Assert.assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); }