@Test public void getRulesTest() { List<Rule> ruleDetails = Lists.newArrayList(); Optional<Rule> rule = getRuleDetailsResponse(); ruleDetails.add(rule.get()); Page<Rule> allPoliciesDetails = new PageImpl<Rule>(ruleDetails, new PageRequest(0, 1), ruleDetails.size()); when(ruleService.getRules(StringUtils.EMPTY, 0, 1)).thenReturn(allPoliciesDetails); assertThat(ruleRepository.findAll(StringUtils.EMPTY, new PageRequest(0, 1)).getContent().size(), is(1)); }
@Override public Page<Rule> getRules(final String searchTerm, final int page, final int size) { return ruleRepository.findAll(searchTerm.toLowerCase(), PageRequest.of(page, size)); }
RuleServiceImpl implements RuleService { @Override public Page<Rule> getRules(final String searchTerm, final int page, final int size) { return ruleRepository.findAll(searchTerm.toLowerCase(), PageRequest.of(page, size)); } }
RuleServiceImpl implements RuleService { @Override public Page<Rule> getRules(final String searchTerm, final int page, final int size) { return ruleRepository.findAll(searchTerm.toLowerCase(), PageRequest.of(page, size)); }  }
RuleServiceImpl implements RuleService { @Override public Page<Rule> getRules(final String searchTerm, final int page, final int size) { return ruleRepository.findAll(searchTerm.toLowerCase(), PageRequest.of(page, size)); }  @Override List<Rule> getAllRulesByTargetType(String targetType); @Override List<RuleProjection> getAllRulesByTargetTypeName(String targetType); @Override List<RuleProjection> getAllRulesByTargetTypeAndNotInRuleIdList(final String targetType, final List<String> ruleIdList); @Override List<RuleProjection> getAllRulesByTargetTypeAndRuleIdList(final String targetType, final List<String> ruleIdList); @Override Rule getByRuleId(String ruleId); @Override Page<Rule> getRules(final String searchTerm, final int page, final int size); @Override Collection<String> getAllAlexaKeywords(); @Override Collection<String> getAllRuleIds(); @Override String createRule(final MultipartFile fileToUpload, final CreateUpdateRuleDetails ruleDetails, final String userId); @Override String updateRule(MultipartFile fileToUpload, CreateUpdateRuleDetails updateRuleDetails, String userId); @Override String invokeRule(String ruleId, List<Map<String, Object>> ruleOptionalParams); @Override String enableDisableRule(final String ruleId, final String action, final String userId); @Override Map<String, Object> invokeAllRules(List<String> ruleIds); boolean isRuleIdExits(String ruleId); @Override List<RuleCategory> getAllRuleCategories(); }
RuleServiceImpl implements RuleService { @Override public Page<Rule> getRules(final String searchTerm, final int page, final int size) { return ruleRepository.findAll(searchTerm.toLowerCase(), PageRequest.of(page, size)); }  @Override List<Rule> getAllRulesByTargetType(String targetType); @Override List<RuleProjection> getAllRulesByTargetTypeName(String targetType); @Override List<RuleProjection> getAllRulesByTargetTypeAndNotInRuleIdList(final String targetType, final List<String> ruleIdList); @Override List<RuleProjection> getAllRulesByTargetTypeAndRuleIdList(final String targetType, final List<String> ruleIdList); @Override Rule getByRuleId(String ruleId); @Override Page<Rule> getRules(final String searchTerm, final int page, final int size); @Override Collection<String> getAllAlexaKeywords(); @Override Collection<String> getAllRuleIds(); @Override String createRule(final MultipartFile fileToUpload, final CreateUpdateRuleDetails ruleDetails, final String userId); @Override String updateRule(MultipartFile fileToUpload, CreateUpdateRuleDetails updateRuleDetails, String userId); @Override String invokeRule(String ruleId, List<Map<String, Object>> ruleOptionalParams); @Override String enableDisableRule(final String ruleId, final String action, final String userId); @Override Map<String, Object> invokeAllRules(List<String> ruleIds); boolean isRuleIdExits(String ruleId); @Override List<RuleCategory> getAllRuleCategories();  }