use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method get_render_variable_missing.
@Test
public void get_render_variable_missing() {
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
ComponentModel model = mockComponentModel();
train_getModel(ins, model);
replay();
ComponentResources resources = new InternalComponentResourcesImpl(null, null, null, elementResources, "Foo.bar", null, ins, false);
resources.storeRenderVariable("fred", "FRED");
resources.storeRenderVariable("barney", "BARNEY");
try {
resources.getRenderVariable("wilma");
unreachable();
} catch (IllegalArgumentException ex) {
assertEquals(ex.getMessage(), "Component Foo.bar does not contain a stored render variable with name 'wilma'. Stored render variables: barney, fred.");
}
verify();
}
use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method get_property_name_internal_prop_binding.
@Test
public void get_property_name_internal_prop_binding() {
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
ComponentModel model = mockComponentModel();
ComponentPageElement element = mockComponentPageElement();
Page page = mockPage();
InternalPropBinding binding = newMock(InternalPropBinding.class);
train_getModel(ins, model);
expect(binding.getPropertyName()).andReturn("foo");
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(page, element, null, null, null, null, ins, false);
resources.bindParameter("bar", binding);
assertEquals(resources.getPropertyName("bar"), "foo");
verify();
}
Aggregations