use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method libraryName_property.
@Test
public void libraryName_property() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, "superduper");
assertEquals(model.getLibraryName(), "superduper");
verify();
}
use of org.apache.tapestry5.model.MutableComponentModel 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.model.MutableComponentModel 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.model.MutableComponentModel 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.model.MutableComponentModel 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