@Test
public void cached_object_read() throws Exception
{
InternalComponentResources resources = mockInternalComponentResources();
Component component = setupForIntegrationTest(resources);
train_isLoaded(resources, true);
train_isBound(resources, "object", true);
train_readParameter(resources, "object", String.class, "first");
train_isRendering(resources, false);
replay();
assertEquals(_access.get(component, "object"), "first");
verify();
// Keeps re-reading the parameter when not rendering.
train_isLoaded(resources, true);
train_isBound(resources, "object", true);
train_readParameter(resources, "object", String.class, "second");
train_isRendering(resources, false);
replay();
assertEquals(_access.get(component, "object"), "second");
verify();
// Now, when rendering is active, the value is cached
train_isLoaded(resources, true);
train_isBound(resources, "object", true);
train_readParameter(resources, "object", String.class, "third");
train_isRendering(resources, true);
replay();
assertEquals(_access.get(component, "object"), "third");
// Does not cause readParameter() to be invoked:
assertEquals(_access.get(component, "object"), "third");
verify();
train_isLoaded(resources, true);
train_isBound(resources, "object", true);
train_readParameter(resources, "object", String.class, "fourth");
train_isRendering(resources, false);
replay();
component.postRenderCleanup();
assertEquals(_access.get(component, "object"), "fourth");
verify();
}