ConfigurableApplicationContext parent = new GenericApplicationContext();
parent.refresh();
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
child.setParent(parent);
child.refresh();
ConfigurableEnvironment env = child.getBean(ConfigurableEnvironment.class);
assertThat("unknown env", env, anyOf(
sameInstance(parent.getEnvironment()),
sameInstance(child.getEnvironment())));