@Test public void addABookmark() throws Exception { Bookmark value = new Bookmark("Packt publishing", "http: addBookmark(value); Mockito.verify(bookmarkService, atLeastOnce()).addBookmark(Mockito.any(Bookmark.class)); }
@PostMapping @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark){ UUID uuid = bookmarkService.addBookmark(bookmark); return ResponseEntity.created( BasicLinkBuilder.linkToCurrentMapping() .slash("bookmark") .slash(uuid) .toUri()) .build(); }
BookmarksController { @PostMapping @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark){ UUID uuid = bookmarkService.addBookmark(bookmark); return ResponseEntity.created( BasicLinkBuilder.linkToCurrentMapping() .slash("bookmark") .slash(uuid) .toUri()) .build(); } }
BookmarksController { @PostMapping @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark){ UUID uuid = bookmarkService.addBookmark(bookmark); return ResponseEntity.created( BasicLinkBuilder.linkToCurrentMapping() .slash("bookmark") .slash(uuid) .toUri()) .build(); }  }
BookmarksController { @PostMapping @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark){ UUID uuid = bookmarkService.addBookmark(bookmark); return ResponseEntity.created( BasicLinkBuilder.linkToCurrentMapping() .slash("bookmark") .slash(uuid) .toUri()) .build(); }  @PostMapping @PreAuthorize("hasRole('ADMIN')") ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark); @GetMapping Resources<Resource<Bookmark>> findAllBookmarks(HttpServletRequest request); }
BookmarksController { @PostMapping @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark){ UUID uuid = bookmarkService.addBookmark(bookmark); return ResponseEntity.created( BasicLinkBuilder.linkToCurrentMapping() .slash("bookmark") .slash(uuid) .toUri()) .build(); }  @PostMapping @PreAuthorize("hasRole('ADMIN')") ResponseEntity<Void> addBookmark(@RequestBody @Valid Bookmark bookmark); @GetMapping Resources<Resource<Bookmark>> findAllBookmarks(HttpServletRequest request);  }