@Test public void deleteTest() throws Exception { this.mockMvc.perform(delete(tipsAndTricksLink + "/{id}", 1)) .andExpect(status().isOk()); verify(tipsAndTricksService, times(1)) .delete(eq(1L)); }
@ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") public ResponseEntity<Object> delete(@PathVariable Long id) { tipsAndTricksService.delete(id); return ResponseEntity.status(HttpStatus.OK).build(); }
TipsAndTricksController { @ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") public ResponseEntity<Object> delete(@PathVariable Long id) { tipsAndTricksService.delete(id); return ResponseEntity.status(HttpStatus.OK).build(); } }
TipsAndTricksController { @ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") public ResponseEntity<Object> delete(@PathVariable Long id) { tipsAndTricksService.delete(id); return ResponseEntity.status(HttpStatus.OK).build(); }  }
TipsAndTricksController { @ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") public ResponseEntity<Object> delete(@PathVariable Long id) { tipsAndTricksService.delete(id); return ResponseEntity.status(HttpStatus.OK).build(); }  @ApiOperation(value = "Add new tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 201, message = HttpStatuses.CREATED, response = TipsAndTricksDtoResponse.class), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @PostMapping(consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) ResponseEntity<TipsAndTricksDtoResponse> save(
        @ApiParam(value = "Add tips & tricks request", required = true)
        @RequestPart @ValidTipsAndTricksDtoRequest TipsAndTricksDtoRequest tipsAndTricksDtoRequest,
        @ApiParam(value = "Tips & tricks image")
        @ImageValidation
        @RequestPart(required = false) MultipartFile image,
        @ApiIgnore Principal principal); @ApiOperation(value = "Get tips & tricks by id.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("/{id}") ResponseEntity<TipsAndTricksDtoResponse> getTipsAndTricksById(@PathVariable Long id); @ApiOperation(value = "Find all tips & tricks by page.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("") @ApiPageable ResponseEntity<PageableDto<TipsAndTricksDtoResponse>> findAll(@ApiIgnore Pageable page); @ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") ResponseEntity<Object> delete(@PathVariable Long id); @ApiOperation(value = "Get tips & tricks by tags") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("/tags") @ApiPageable ResponseEntity<PageableDto<TipsAndTricksDtoResponse>> getTipsAndTricks(
        @ApiIgnore Pageable page,
        @ApiParam(value = "Tags to filter (if no tags, get all)")
        @RequestParam(required = false) List<String> tags
    ); @ApiOperation(value = "Find all tips & tricks tags") @GetMapping("/tags/all") ResponseEntity<List<String>> findAllTipsAndTricksTags(); }
TipsAndTricksController { @ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") public ResponseEntity<Object> delete(@PathVariable Long id) { tipsAndTricksService.delete(id); return ResponseEntity.status(HttpStatus.OK).build(); }  @ApiOperation(value = "Add new tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 201, message = HttpStatuses.CREATED, response = TipsAndTricksDtoResponse.class), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @PostMapping(consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) ResponseEntity<TipsAndTricksDtoResponse> save(
        @ApiParam(value = "Add tips & tricks request", required = true)
        @RequestPart @ValidTipsAndTricksDtoRequest TipsAndTricksDtoRequest tipsAndTricksDtoRequest,
        @ApiParam(value = "Tips & tricks image")
        @ImageValidation
        @RequestPart(required = false) MultipartFile image,
        @ApiIgnore Principal principal); @ApiOperation(value = "Get tips & tricks by id.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("/{id}") ResponseEntity<TipsAndTricksDtoResponse> getTipsAndTricksById(@PathVariable Long id); @ApiOperation(value = "Find all tips & tricks by page.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("") @ApiPageable ResponseEntity<PageableDto<TipsAndTricksDtoResponse>> findAll(@ApiIgnore Pageable page); @ApiOperation(value = "Delete tips & tricks.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @DeleteMapping("/{id}") ResponseEntity<Object> delete(@PathVariable Long id); @ApiOperation(value = "Get tips & tricks by tags") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("/tags") @ApiPageable ResponseEntity<PageableDto<TipsAndTricksDtoResponse>> getTipsAndTricks(
        @ApiIgnore Pageable page,
        @ApiParam(value = "Tags to filter (if no tags, get all)")
        @RequestParam(required = false) List<String> tags
    ); @ApiOperation(value = "Find all tips & tricks tags") @GetMapping("/tags/all") ResponseEntity<List<String>> findAllTipsAndTricksTags();  }