### Question:
RangerValidator { Set<String> getPolicyResources(RangerPolicy policy) { if (policy == null || policy.getResources() == null || policy.getResources().isEmpty()) { return new HashSet<String>(); } else { Set<String> result = new HashSet<String>(); for (String name : policy.getResources().keySet()) { result.add(name.toLowerCase()); } return result; } } protected  RangerValidator(ServiceStore store); void validate(Long id, Action action);  }### Answer:
@Test public void test_getPolicyResources() { Set<String> result; RangerPolicy policy = null; result = _validator.getPolicyResources(null); assertTrue(result != null); assertTrue(result.isEmpty()); policy = mock(RangerPolicy.class); when(policy.getResources()).thenReturn(null); result = _validator.getPolicyResources(null); assertTrue(result != null); assertTrue(result.isEmpty()); Map<String, RangerPolicyResource> input = Maps.newHashMap(); when(policy.getResources()).thenReturn(input); result = _validator.getPolicyResources(policy); assertTrue(result != null); assertTrue(result.isEmpty()); input.put("r1", mock(RangerPolicyResource.class)); input.put("R2", mock(RangerPolicyResource.class)); result = _validator.getPolicyResources(policy); assertEquals(2, result.size()); assertTrue("r1", result.contains("r1")); assertTrue("R2", result.contains("r2")); }