@Test public void test_getImpliedGrants() { Collection<String> result = _validator.getImpliedGrants(null); Assert.assertNull(result); RangerAccessTypeDef accessTypeDef = mock(RangerAccessTypeDef.class); when(accessTypeDef.getImpliedGrants()).thenReturn(null); result = _validator.getImpliedGrants(accessTypeDef); Assert.assertTrue(result.isEmpty()); List<String> impliedGrants = new ArrayList<>(); when(accessTypeDef.getImpliedGrants()).thenReturn(impliedGrants); result = _validator.getImpliedGrants(accessTypeDef); Assert.assertTrue(result.isEmpty()); impliedGrants = Arrays.asList(new String[] { null, "", " ", " " }); when(accessTypeDef.getImpliedGrants()).thenReturn(impliedGrants); result = _validator.getImpliedGrants(accessTypeDef); Assert.assertEquals(4, result.size()); impliedGrants = Arrays.asList(new String[] { "a", "B", "C ", " d " }); when(accessTypeDef.getImpliedGrants()).thenReturn(impliedGrants); result = _validator.getImpliedGrants(accessTypeDef); Assert.assertEquals(4, result.size()); Assert.assertTrue(result.contains("a")); Assert.assertTrue(result.contains("b")); Assert.assertTrue(result.contains("c ")); Assert.assertTrue(result.contains(" d ")); }
Collection<String> getImpliedGrants(RangerAccessTypeDef def) { if (def == null) { return null; } else if (CollectionUtils.isEmpty(def.getImpliedGrants())) { return new ArrayList<>(); } else { List<String> result = new ArrayList<String>(def.getImpliedGrants().size()); for (String name : def.getImpliedGrants()) { if (StringUtils.isBlank(name)) { result.add(name); } else { result.add(name.toLowerCase()); } } return result; } }
RangerValidator { Collection<String> getImpliedGrants(RangerAccessTypeDef def) { if (def == null) { return null; } else if (CollectionUtils.isEmpty(def.getImpliedGrants())) { return new ArrayList<>(); } else { List<String> result = new ArrayList<String>(def.getImpliedGrants().size()); for (String name : def.getImpliedGrants()) { if (StringUtils.isBlank(name)) { result.add(name); } else { result.add(name.toLowerCase()); } } return result; } } }
RangerValidator { Collection<String> getImpliedGrants(RangerAccessTypeDef def) { if (def == null) { return null; } else if (CollectionUtils.isEmpty(def.getImpliedGrants())) { return new ArrayList<>(); } else { List<String> result = new ArrayList<String>(def.getImpliedGrants().size()); for (String name : def.getImpliedGrants()) { if (StringUtils.isBlank(name)) { result.add(name); } else { result.add(name.toLowerCase()); } } return result; } } protected  RangerValidator(ServiceStore store); protected  RangerValidator(RoleStore roleStore); }
RangerValidator { Collection<String> getImpliedGrants(RangerAccessTypeDef def) { if (def == null) { return null; } else if (CollectionUtils.isEmpty(def.getImpliedGrants())) { return new ArrayList<>(); } else { List<String> result = new ArrayList<String>(def.getImpliedGrants().size()); for (String name : def.getImpliedGrants()) { if (StringUtils.isBlank(name)) { result.add(name); } else { result.add(name.toLowerCase()); } } return result; } } protected  RangerValidator(ServiceStore store); protected  RangerValidator(RoleStore roleStore); void validate(Long id, Action action); void validate(String name, Action action); static String serializeFailures(List<ValidationFailureDetails> failures); }
RangerValidator { Collection<String> getImpliedGrants(RangerAccessTypeDef def) { if (def == null) { return null; } else if (CollectionUtils.isEmpty(def.getImpliedGrants())) { return new ArrayList<>(); } else { List<String> result = new ArrayList<String>(def.getImpliedGrants().size()); for (String name : def.getImpliedGrants()) { if (StringUtils.isBlank(name)) { result.add(name); } else { result.add(name.toLowerCase()); } } return result; } } protected  RangerValidator(ServiceStore store); protected  RangerValidator(RoleStore roleStore); void validate(Long id, Action action); void validate(String name, Action action); static String serializeFailures(List<ValidationFailureDetails> failures);  }