assertContexts(containerSystem);
}
private void assertContexts(ContainerSystem containerSystem) {
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
final ModuleContext moduleContext = beanContext.getModuleContext();
final AppContext appContext = moduleContext.getAppContext();
{ // Assert as Properties
// ModuleContext should have color property
assertProperty(moduleContext.getProperties(), "color", "orange");
// BeanContext and AppContext should not
assertNoProperty(beanContext.getProperties(), "color");
assertNoProperty(appContext.getProperties(), "color");
// Try all the above again with mixed case
assertProperty(moduleContext.getProperties(), "coLOr", "orange");
assertNoProperty(beanContext.getProperties(), "coLOr");
assertNoProperty(appContext.getProperties(), "coLOr");
}
{ // Assert as Options
// ModuleContext should have color option
assertOption(moduleContext.getOptions(), "color", "orange");
// BeanContext should inherit ModuleContext color
assertOption(beanContext.getOptions(), "color", "orange");
// AppContext should remain unpolluted
assertNoOption(appContext.getOptions(), "color");
// Try all the above again using mixed case
assertOption(moduleContext.getOptions(), "coLoR", "orange");
assertOption(beanContext.getOptions(), "coLoR", "orange");
assertNoOption(appContext.getOptions(), "coLoR");
}
}