@Test public void testComplaintStatusMappingService() throws Exception { String status = "REGISTERED"; List<ComplaintStatus> complaintStatuses = Collections.singletonList( new ComplaintStatus(1L, "REGISTERED","default","0001") ); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(status, Arrays.asList(1L, 2L),"default"); when(complaintStatusService.getNextStatuses(complaintStatusSearchCriteria)).thenReturn(complaintStatuses); mockMvc.perform( post("/nextstatuses/v1/_search") .param("currentStatus", status) .contentType(MediaType.APPLICATION_JSON) .content(resources.getFileContents("complaintStatusRequest.json")) ) .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(resources.getFileContents("complaintStatusResponse.json"))); }
@PostMapping("/nextstatuses/v1/_search") public List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatus, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatus, roles,tenantId); return complaintStatusService.getNextStatuses(complaintStatusSearchCriteria).stream() .map(ComplaintStatus::new).collect(Collectors.toList()); }
ComplaintStatusController { @PostMapping("/nextstatuses/v1/_search") public List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatus, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatus, roles,tenantId); return complaintStatusService.getNextStatuses(complaintStatusSearchCriteria).stream() .map(ComplaintStatus::new).collect(Collectors.toList()); } }
ComplaintStatusController { @PostMapping("/nextstatuses/v1/_search") public List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatus, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatus, roles,tenantId); return complaintStatusService.getNextStatuses(complaintStatusSearchCriteria).stream() .map(ComplaintStatus::new).collect(Collectors.toList()); }  }
ComplaintStatusController { @PostMapping("/nextstatuses/v1/_search") public List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatus, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatus, roles,tenantId); return complaintStatusService.getNextStatuses(complaintStatusSearchCriteria).stream() .map(ComplaintStatus::new).collect(Collectors.toList()); }  @PostMapping("/statuses/v1/_search") List<ComplaintStatus> getAllStatus(@RequestBody final ComplaintStatusRequest request,
                                              @RequestParam(defaultValue = "Complaint") final String keyword,
                                              @RequestParam(defaultValue = "default") final String tenantId); @PostMapping("/nextstatuses/v1/_search") List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request,
                                                 @RequestParam final String currentStatus,
                                                 @RequestParam(defaultValue = "default") final String tenantId); }
ComplaintStatusController { @PostMapping("/nextstatuses/v1/_search") public List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request, @RequestParam final String currentStatus, @RequestParam(defaultValue = "default") final String tenantId) { List<Long> roles = request.getRequestInfo().getUserInfo().getRoles().stream() .map(Role::getId) .collect(Collectors.toList()); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(currentStatus, roles,tenantId); return complaintStatusService.getNextStatuses(complaintStatusSearchCriteria).stream() .map(ComplaintStatus::new).collect(Collectors.toList()); }  @PostMapping("/statuses/v1/_search") List<ComplaintStatus> getAllStatus(@RequestBody final ComplaintStatusRequest request,
                                              @RequestParam(defaultValue = "Complaint") final String keyword,
                                              @RequestParam(defaultValue = "default") final String tenantId); @PostMapping("/nextstatuses/v1/_search") List<ComplaintStatus> getNextStatuses(@RequestBody final ComplaintStatusRequest request,
                                                 @RequestParam final String currentStatus,
                                                 @RequestParam(defaultValue = "default") final String tenantId);  }