Resource extends BaseEntity { public void setParent(Resource parent) { if (null == parent && null == this.persona) { throw new IllegalStateException("A resource should either have a valid parent or an owner."); } this.parent = parent; } Resource(Persona persona);  Resource(Resource parent);  Resource(Persona persona, Resource parent);  Resource(String id, Resource parent);  Resource(String id, Persona persona);  Resource(String id, Persona persona, Resource parent);  Resource(UUID id, ZonedDateTime createdAt, ZonedDateTime updatedAt,
                    Persona persona, Resource parent); Persona getPersona(); Resource getParent(); void setParent(Resource parent); void setPersona(Persona persona);  }
@Test(expected = IllegalStateException.class) public void testResetWithNullOwner() { Persona persona = new HawkularUser(UUID.randomUUID(), "John Doe"); Resource host1 = new Resource(persona); Resource host2 = new Resource(persona); Resource memoryHost1 = new Resource(host1); memoryHost1.setParent(null); }