@Test public void testShouldGetModuleList() throws Exception { when(actionService.getAllActions(any(ActionRequest.class))).thenReturn(getModuleList()); ResponseInfo responseInfo = ResponseInfo.builder().build(); responseInfo.setApiId("org.egov.accesscontrol"); responseInfo.setTs("Thu Mar 09 18:30:00 UTC 2017"); responseInfo.setMsgId("20170310130900"); responseInfo.setResMsgId("uief87324"); responseInfo.setVer("1.0"); when(responseInfoFactory.createResponseInfoFromRequestInfo(any(RequestInfo.class), any(Boolean.class))) .thenReturn(responseInfo); mockMvc.perform(post("/v1/actions/_get").contentType(MediaType.APPLICATION_JSON_UTF8) .content(new Resources().getFileContents("actionListRequest.json"))).andExpect(status().isOk()); }
@PostMapping(value = "_get") public ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest){ final List<ErrorResponse> errorResponses = validateActionRequest(actionRequest, "get"); if (!errorResponses.isEmpty()) return new ResponseEntity<>(errorResponses, HttpStatus.BAD_REQUEST); List<Action> actionList = actionService.getAllActions(actionRequest); return getNewListSuccessResponse(actionRequest.getRequestInfo(), actionList); }
ActionController { @PostMapping(value = "_get") public ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest){ final List<ErrorResponse> errorResponses = validateActionRequest(actionRequest, "get"); if (!errorResponses.isEmpty()) return new ResponseEntity<>(errorResponses, HttpStatus.BAD_REQUEST); List<Action> actionList = actionService.getAllActions(actionRequest); return getNewListSuccessResponse(actionRequest.getRequestInfo(), actionList); } }
ActionController { @PostMapping(value = "_get") public ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest){ final List<ErrorResponse> errorResponses = validateActionRequest(actionRequest, "get"); if (!errorResponses.isEmpty()) return new ResponseEntity<>(errorResponses, HttpStatus.BAD_REQUEST); List<Action> actionList = actionService.getAllActions(actionRequest); return getNewListSuccessResponse(actionRequest.getRequestInfo(), actionList); }  }
ActionController { @PostMapping(value = "_get") public ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest){ final List<ErrorResponse> errorResponses = validateActionRequest(actionRequest, "get"); if (!errorResponses.isEmpty()) return new ResponseEntity<>(errorResponses, HttpStatus.BAD_REQUEST); List<Action> actionList = actionService.getAllActions(actionRequest); return getNewListSuccessResponse(actionRequest.getRequestInfo(), actionList); }  @PostMapping(value = "_search") ActionResponse getActionsBasedOnRoles(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "_list") ResponseEntity<?> getAllActionsBasedOnRoles(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "_get") ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "mdms/_get") ResponseEntity<?> getAllMDMSActions(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "_validate") ValidateActionResponse validateAction(@RequestBody ValidateActionRequest validateActionRequest); @PostMapping(value = "_authorize") ResponseEntity<Void> authorize(@RequestBody @Valid AuthorizationRequestWrapper authorizationRequestWrapper); @PostMapping(value = "_create") ResponseEntity<?> createAction(@RequestBody @Valid final ActionRequest actionRequest,
			final BindingResult errors); @PostMapping(value = "_update") ResponseEntity<?> updateAction(@RequestBody @Valid final ActionRequest actionRequest,
			final BindingResult errors); }
ActionController { @PostMapping(value = "_get") public ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest){ final List<ErrorResponse> errorResponses = validateActionRequest(actionRequest, "get"); if (!errorResponses.isEmpty()) return new ResponseEntity<>(errorResponses, HttpStatus.BAD_REQUEST); List<Action> actionList = actionService.getAllActions(actionRequest); return getNewListSuccessResponse(actionRequest.getRequestInfo(), actionList); }  @PostMapping(value = "_search") ActionResponse getActionsBasedOnRoles(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "_list") ResponseEntity<?> getAllActionsBasedOnRoles(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "_get") ResponseEntity<?> getAllActions(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "mdms/_get") ResponseEntity<?> getAllMDMSActions(@RequestBody final ActionRequest actionRequest); @PostMapping(value = "_validate") ValidateActionResponse validateAction(@RequestBody ValidateActionRequest validateActionRequest); @PostMapping(value = "_authorize") ResponseEntity<Void> authorize(@RequestBody @Valid AuthorizationRequestWrapper authorizationRequestWrapper); @PostMapping(value = "_create") ResponseEntity<?> createAction(@RequestBody @Valid final ActionRequest actionRequest,
			final BindingResult errors); @PostMapping(value = "_update") ResponseEntity<?> updateAction(@RequestBody @Valid final ActionRequest actionRequest,
			final BindingResult errors);  }