PersonaServiceImpl implements PersonaService { public Persona get(String id) { if (null == id) { throw new IllegalArgumentException("The provided Persona ID is invalid (null)."); } Persona persona; UUID uuid = UUID.fromString(id); persona = userService.getById(uuid); if (null == persona) { persona = organizationService.getById(uuid); } return persona; }  Persona getById(UUID id); Persona get(String id); @Override Set<Role> getEffectiveRolesForResource(Persona persona, Resource resource); @Override @Produces Persona getCurrent(); @Override boolean isAllowedToImpersonate(HawkularUser actual, Persona toImpersonate);  }
@Test public void existingIdIsFound() { String id = UUID.randomUUID().toString(); userService.getOrCreateById(id); assertNotNull(personaService.get(id)); }
@Test public void nonExistingIdReturnsNull() { assertNull(personaService.get(UUID.randomUUID().toString())); }