@Test public void test_should_delete_messages() throws Exception { mockMvc.perform(post("/messages/v1/_delete") .content(getFileContents("deleteMessageRequest.json")) .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(getFileContents("deleteMessagesResponse.json"))); final MessageIdentity messageIdentity1 = MessageIdentity.builder() .code("code1") .module("module1") .locale("locale1") .tenant(new Tenant("tenant1")) .build(); final MessageIdentity messageIdentity2 = MessageIdentity.builder() .code("code2") .module("module2") .locale("locale2") .tenant(new Tenant("tenant1")) .build(); final List<MessageIdentity> expectedMessageIdentities = Arrays.asList(messageIdentity1, messageIdentity2); verify(messageService).delete(expectedMessageIdentities); }
@PostMapping(value = "/v1/_delete") public DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest, final BindingResult bindingResult) { if (bindingResult.hasErrors()) { throw new InvalidMessageRequest(bindingResult.getFieldErrors()); } messageService.delete(deleteMessagesRequest.getMessageIdentities()); return new DeleteMessagesResponse(true); }
MessageController { @PostMapping(value = "/v1/_delete") public DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest, final BindingResult bindingResult) { if (bindingResult.hasErrors()) { throw new InvalidMessageRequest(bindingResult.getFieldErrors()); } messageService.delete(deleteMessagesRequest.getMessageIdentities()); return new DeleteMessagesResponse(true); } }
MessageController { @PostMapping(value = "/v1/_delete") public DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest, final BindingResult bindingResult) { if (bindingResult.hasErrors()) { throw new InvalidMessageRequest(bindingResult.getFieldErrors()); } messageService.delete(deleteMessagesRequest.getMessageIdentities()); return new DeleteMessagesResponse(true); } MessageController(MessageService messageService); }
MessageController { @PostMapping(value = "/v1/_delete") public DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest, final BindingResult bindingResult) { if (bindingResult.hasErrors()) { throw new InvalidMessageRequest(bindingResult.getFieldErrors()); } messageService.delete(deleteMessagesRequest.getMessageIdentities()); return new DeleteMessagesResponse(true); } MessageController(MessageService messageService); @GetMapping() MessagesResponse getMessagesForLocale(@RequestParam("locale") String locale,
			@RequestParam(value = "module", required = false) String module,
			@RequestParam("tenantId") String tenantId); @PostMapping("/v1/_search") MessagesResponse getMessages(@RequestParam("locale") String locale,
			@RequestParam(value = "module", required = false) String module,
			@RequestParam("tenantId") String tenantId); @PostMapping("/v1/_upsert") MessagesResponse upsertMessages(@Valid @RequestBody CreateMessagesRequest messageRequest,
			BindingResult bindingResult); @PostMapping("/v1/_create") MessagesResponse createMessages(@Valid @RequestBody CreateMessagesRequest messageRequest,
			BindingResult bindingResult); @PostMapping("/cache-bust") CacheBustResponse clearMessagesCache(); @PostMapping(value = "/v1/_update") MessagesResponse update(@RequestBody @Valid final UpdateMessageRequest messageRequest,
			final BindingResult bindingResult); @PostMapping(value = "/v1/_delete") DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest,
			final BindingResult bindingResult); }
MessageController { @PostMapping(value = "/v1/_delete") public DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest, final BindingResult bindingResult) { if (bindingResult.hasErrors()) { throw new InvalidMessageRequest(bindingResult.getFieldErrors()); } messageService.delete(deleteMessagesRequest.getMessageIdentities()); return new DeleteMessagesResponse(true); } MessageController(MessageService messageService); @GetMapping() MessagesResponse getMessagesForLocale(@RequestParam("locale") String locale,
			@RequestParam(value = "module", required = false) String module,
			@RequestParam("tenantId") String tenantId); @PostMapping("/v1/_search") MessagesResponse getMessages(@RequestParam("locale") String locale,
			@RequestParam(value = "module", required = false) String module,
			@RequestParam("tenantId") String tenantId); @PostMapping("/v1/_upsert") MessagesResponse upsertMessages(@Valid @RequestBody CreateMessagesRequest messageRequest,
			BindingResult bindingResult); @PostMapping("/v1/_create") MessagesResponse createMessages(@Valid @RequestBody CreateMessagesRequest messageRequest,
			BindingResult bindingResult); @PostMapping("/cache-bust") CacheBustResponse clearMessagesCache(); @PostMapping(value = "/v1/_update") MessagesResponse update(@RequestBody @Valid final UpdateMessageRequest messageRequest,
			final BindingResult bindingResult); @PostMapping(value = "/v1/_delete") DeleteMessagesResponse delete(@RequestBody @Valid final DeleteMessagesRequest deleteMessagesRequest,
			final BindingResult bindingResult);  }