use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class MutableComponentModelImplTest method get_mixin_class_names_with_no_mixins.
@Test
public void get_mixin_class_names_with_no_mixins() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
ComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
assertTrue(model.getMixinClassNames().isEmpty());
verify();
}
use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class MutableComponentModelImplTest method add_parameters_to_embedded.
@Test
public void add_parameters_to_embedded() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false, null);
assertTrue(fred.getParameterNames().isEmpty());
fred.addParameter("city", "bedrock");
fred.addParameter("job", "crane operator");
assertEquals(fred.getParameterNames(), Arrays.asList("city", "job"));
assertEquals(fred.getParameterValue("city"), "bedrock");
verify();
}
use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class MutableComponentModelImplTest method get_parent_from_subclass.
@Test
public void get_parent_from_subclass() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel parent = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
MutableComponentModel child = new MutableComponentModelImpl(CLASS_NAME, logger, r, parent, false, null);
assertSame(child.getParentModel(), parent);
assertNull(parent.getParentModel());
verify();
}
use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class MutableComponentModelImplTest method add_embedded_component_with_duplicate_id.
@Test
public void add_embedded_component_with_duplicate_id() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
model.addEmbeddedComponent("fred", "Fred1", COMPONENT_CLASS_NAME, false, null);
try {
model.addEmbeddedComponent("fred", "Fred2", COMPONENT_CLASS_NAME, false, null);
unreachable();
} catch (IllegalArgumentException ex) {
assertEquals(ex.getMessage(), "Embedded component 'fred' has already been defined for component class org.example.components.Foo.");
}
verify();
}
use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class MutableComponentModelImplTest method mixin_names_is_initially_empty_list.
@Test
public void mixin_names_is_initially_empty_list() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false, null);
assertTrue(fred.getMixinClassNames().isEmpty());
verify();
}
Aggregations