@Test public void test_getServiceDef_byId() throws Exception { when(_store.getServiceDef(1L)).thenReturn(null); when(_store.getServiceDef(2L)).thenThrow(new Exception()); RangerServiceDef serviceDef = mock(RangerServiceDef.class); when(_store.getServiceDef(3L)).thenReturn(serviceDef); Assert.assertNull(_validator.getServiceDef(1L)); Assert.assertNull(_validator.getServiceDef(2L)); Assert.assertTrue(_validator.getServiceDef(3L) != null); }
RangerServiceDef getServiceDef(Long id) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerValidator.getServiceDef(" + id + ")"); } RangerServiceDef result = null; try { result = _store.getServiceDef(id); } catch (Exception e) { LOG.debug("Encountred exception while retrieving service def from service store!", e); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getServiceDef(" + id + "): " + result); } return result; }
RangerValidator { RangerServiceDef getServiceDef(Long id) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerValidator.getServiceDef(" + id + ")"); } RangerServiceDef result = null; try { result = _store.getServiceDef(id); } catch (Exception e) { LOG.debug("Encountred exception while retrieving service def from service store!", e); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getServiceDef(" + id + "): " + result); } return result; } }
RangerValidator { RangerServiceDef getServiceDef(Long id) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerValidator.getServiceDef(" + id + ")"); } RangerServiceDef result = null; try { result = _store.getServiceDef(id); } catch (Exception e) { LOG.debug("Encountred exception while retrieving service def from service store!", e); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getServiceDef(" + id + "): " + result); } return result; } protected  RangerValidator(ServiceStore store); protected  RangerValidator(RoleStore roleStore); }
RangerValidator { RangerServiceDef getServiceDef(Long id) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerValidator.getServiceDef(" + id + ")"); } RangerServiceDef result = null; try { result = _store.getServiceDef(id); } catch (Exception e) { LOG.debug("Encountred exception while retrieving service def from service store!", e); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getServiceDef(" + id + "): " + result); } 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 { RangerServiceDef getServiceDef(Long id) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerValidator.getServiceDef(" + id + ")"); } RangerServiceDef result = null; try { result = _store.getServiceDef(id); } catch (Exception e) { LOG.debug("Encountred exception while retrieving service def from service store!", e); } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerValidator.getServiceDef(" + id + "): " + result); } 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);  }