/** More of an integration test. */
@Test
public void load_component_via_service() throws Exception
{
Component target = createComponent(BasicComponent.class);
// Should not be an instance, since it is loaded by a different class loader.
assertFalse(BasicComponent.class.isInstance(target));
_access.set(target, "value", "some default value");
assertEquals(_access.get(target, "value"), "some default value");
_access.set(target, "retainedValue", "some retained value");
assertEquals(_access.get(target, "retainedValue"), "some retained value");
// Setting a property value before pageDidLoad will cause that value
// to be the default when the page detaches.
target.containingPageDidLoad();
_access.set(target, "value", "some transient value");
assertEquals(_access.get(target, "value"), "some transient value");
target.containingPageDidDetach();
assertEquals(_access.get(target, "value"), "some default value");
assertEquals(_access.get(target, "retainedValue"), "some retained value");
}