### Question:
RangerValidator { Collection<String> getImpliedGrants(RangerAccessTypeDef def) { if (def == null) { return null; } else if (CollectionUtils.isEmpty(def.getImpliedGrants())) { return new ArrayList<String>(); } 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); void validate(Long id, Action action);  }### Answer:
@Test public void test_getImpliedGrants() { Collection<String> result = _validator.getImpliedGrants(null); assertNull(result); RangerAccessTypeDef accessTypeDef = mock(RangerAccessTypeDef.class); when(accessTypeDef.getImpliedGrants()).thenReturn(null); result = _validator.getImpliedGrants(accessTypeDef); assertTrue(result.isEmpty()); List<String> impliedGrants = new ArrayList<String>(); when(accessTypeDef.getImpliedGrants()).thenReturn(impliedGrants); result = _validator.getImpliedGrants(accessTypeDef); assertTrue(result.isEmpty()); impliedGrants = Arrays.asList(new String[] { null, "", " ", " " }); when(accessTypeDef.getImpliedGrants()).thenReturn(impliedGrants); result = _validator.getImpliedGrants(accessTypeDef); assertEquals(4, result.size()); impliedGrants = Arrays.asList(new String[] { "a", "B", "C ", " d " }); when(accessTypeDef.getImpliedGrants()).thenReturn(impliedGrants); result = _validator.getImpliedGrants(accessTypeDef); assertEquals(4, result.size()); assertTrue(result.contains("a")); assertTrue(result.contains("b")); assertTrue(result.contains("c ")); assertTrue(result.contains(" d ")); }