BookController { @PutMapping("/updateByTitle/{title}/{author}") public Book updateAuthorByTitle(@PathVariable("title") String title, @PathVariable("author") String author) { return this.bookService.updateAuthorByTitle(title, author); }  @GetMapping("/findByTitle/{title}") Book findBookByTitle(@NotNull @PathVariable String title); @PostMapping("/saveBook") Book saveBook(@Valid @RequestBody Book book); @PutMapping("/updateByTitle/{title}/{author}") Book updateAuthorByTitle(@PathVariable("title") String title, @PathVariable("author") String author); @DeleteMapping("/deleteByTitle/{title}") ResponseEntity<String> deleteBookByTitle(@PathVariable("title") String title); @GetMapping("/deleteCache") String deleteCache(); void deleteAll();  }
@Test void updateBookShouldReturnBook() throws Exception { Book book = Book.builder().title("MongoDbCookBook").author("JUNIT_AUTHOR").bookId("JUNIT").text("JUNIT_TEXT") .build(); given(this.bookService.updateAuthorByTitle(ArgumentMatchers.eq("MongoDbCookBook"), anyString())) .willReturn(book); this.mockMvc .perform(MockMvcRequestBuilders.put("/book/updateByTitle/MongoDbCookBook/Raja1") .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andExpect(jsonPath("title").value("MongoDbCookBook")) .andExpect(jsonPath("author").value("JUNIT_AUTHOR")); }