@Test public void testValidateQueriesRepositoryToValidateTheCriteria() { ActionValidation expectedValidation = ActionValidation.builder().allowed(true).build(); when(repository.run(Mockito.any(ValidateActionQueryBuilder.class), Mockito.any(ActionValidationRowMapper.class))).thenReturn(Arrays.asList(expectedValidation)); assert (actionService.validate(ValidateActionCriteria.builder().build()).isAllowed()); }
public ActionValidation validate(ValidateActionCriteria criteria) { ValidateActionQueryBuilder queryBuilder = new ValidateActionQueryBuilder(criteria); return (ActionValidation) repository.run(queryBuilder, new ActionValidationRowMapper()).get(0); }
ActionService { public ActionValidation validate(ValidateActionCriteria criteria) { ValidateActionQueryBuilder queryBuilder = new ValidateActionQueryBuilder(criteria); return (ActionValidation) repository.run(queryBuilder, new ActionValidationRowMapper()).get(0); } }
ActionService { public ActionValidation validate(ValidateActionCriteria criteria) { ValidateActionQueryBuilder queryBuilder = new ValidateActionQueryBuilder(criteria); return (ActionValidation) repository.run(queryBuilder, new ActionValidationRowMapper()).get(0); } @Autowired  ActionService(BaseRepository repository, ActionRepository actionRepository, MdmsRepository mdmsRepository); }
ActionService { public ActionValidation validate(ValidateActionCriteria criteria) { ValidateActionQueryBuilder queryBuilder = new ValidateActionQueryBuilder(criteria); return (ActionValidation) repository.run(queryBuilder, new ActionValidationRowMapper()).get(0); } @Autowired  ActionService(BaseRepository repository, ActionRepository actionRepository, MdmsRepository mdmsRepository); List<Action> getActions(ActionSearchCriteria actionSearchCriteria); ActionValidation validate(ValidateActionCriteria criteria); List<Action> createAction(ActionRequest actionRequest); List<Action> updateAction(ActionRequest actionRequest); boolean checkActionNameExit(String name); boolean checkCombinationOfUrlAndqueryparamsExist(String url, String queryParams); List<Module> getAllActionsBasedOnRoles(final ActionRequest actionRequest); List<Action> getAllActions(final ActionRequest actionRequest); List<Action> getAllMDMSActions(final ActionRequest actionRequest); boolean isAuthorized(AuthorizationRequest authorizeRequest); }
ActionService { public ActionValidation validate(ValidateActionCriteria criteria) { ValidateActionQueryBuilder queryBuilder = new ValidateActionQueryBuilder(criteria); return (ActionValidation) repository.run(queryBuilder, new ActionValidationRowMapper()).get(0); } @Autowired  ActionService(BaseRepository repository, ActionRepository actionRepository, MdmsRepository mdmsRepository); List<Action> getActions(ActionSearchCriteria actionSearchCriteria); ActionValidation validate(ValidateActionCriteria criteria); List<Action> createAction(ActionRequest actionRequest); List<Action> updateAction(ActionRequest actionRequest); boolean checkActionNameExit(String name); boolean checkCombinationOfUrlAndqueryparamsExist(String url, String queryParams); List<Module> getAllActionsBasedOnRoles(final ActionRequest actionRequest); List<Action> getAllActions(final ActionRequest actionRequest); List<Action> getAllMDMSActions(final ActionRequest actionRequest); boolean isAuthorized(AuthorizationRequest authorizeRequest);  }