@Test public void test_getIsAuditEnabled() { RangerPolicy policy = null; boolean result = _validator.getIsAuditEnabled(policy); Assert.assertFalse(result); policy = mock(RangerPolicy.class); when(policy.getIsAuditEnabled()).thenReturn(null); result = _validator.getIsAuditEnabled(policy); Assert.assertTrue(result); when(policy.getIsAuditEnabled()).thenReturn(Boolean.FALSE); result = _validator.getIsAuditEnabled(policy); Assert.assertFalse(result); when(policy.getIsAuditEnabled()).thenReturn(Boolean.TRUE); result = _validator.getIsAuditEnabled(policy); Assert.assertTrue(result); }
boolean getIsAuditEnabled(RangerPolicy policy) { if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + ")"); } boolean isEnabled = false; if (policy == null) { LOG.warn("policy was null!"); } else if (policy.getIsAuditEnabled() == null) { isEnabled = true; } else { isEnabled = policy.getIsAuditEnabled(); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + "): " + isEnabled); } return isEnabled; }
RangerValidator { boolean getIsAuditEnabled(RangerPolicy policy) { if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + ")"); } boolean isEnabled = false; if (policy == null) { LOG.warn("policy was null!"); } else if (policy.getIsAuditEnabled() == null) { isEnabled = true; } else { isEnabled = policy.getIsAuditEnabled(); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + "): " + isEnabled); } return isEnabled; } }
RangerValidator { boolean getIsAuditEnabled(RangerPolicy policy) { if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + ")"); } boolean isEnabled = false; if (policy == null) { LOG.warn("policy was null!"); } else if (policy.getIsAuditEnabled() == null) { isEnabled = true; } else { isEnabled = policy.getIsAuditEnabled(); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + "): " + isEnabled); } return isEnabled; } protected  RangerValidator(ServiceStore store); protected  RangerValidator(RoleStore roleStore); }
RangerValidator { boolean getIsAuditEnabled(RangerPolicy policy) { if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + ")"); } boolean isEnabled = false; if (policy == null) { LOG.warn("policy was null!"); } else if (policy.getIsAuditEnabled() == null) { isEnabled = true; } else { isEnabled = policy.getIsAuditEnabled(); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + "): " + isEnabled); } return isEnabled; } 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 { boolean getIsAuditEnabled(RangerPolicy policy) { if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + ")"); } boolean isEnabled = false; if (policy == null) { LOG.warn("policy was null!"); } else if (policy.getIsAuditEnabled() == null) { isEnabled = true; } else { isEnabled = policy.getIsAuditEnabled(); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getIsAuditEnabled(" + policy + "): " + isEnabled); } return isEnabled; } 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);  }