use of org.apache.tapestry5.model.MutableEmbeddedComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method add_duplicate_parameters_to_embedded.
@Test
public void add_duplicate_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);
fred.addParameter("city", "bedrock");
try {
fred.addParameter("city", "slateville");
unreachable();
} catch (IllegalArgumentException ex) {
assertEquals(ex.getMessage(), "A value for parameter 'city' of embedded component fred (of component class org.example.components.Foo) has already been provided.");
}
verify();
}
use of org.apache.tapestry5.model.MutableEmbeddedComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method mixin_order_remembered.
@Test
public void mixin_order_remembered() {
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);
fred.addMixin("zip.zop.Zoom", "before:*", "after:foo.bar.Baz");
fred.addMixin("foo.bar.Baz");
assertEquals(fred.getConstraintsForMixin("zip.zop.Zoom"), new String[] { "before:*", "after:foo.bar.Baz" });
assertEquals(fred.getConstraintsForMixin("foo.bar.Baz"), new String[0]);
verify();
}
use of org.apache.tapestry5.model.MutableEmbeddedComponentModel 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.MutableEmbeddedComponentModel 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();
}
use of org.apache.tapestry5.model.MutableEmbeddedComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method mixin_class_names_remembered_in_order_added.
@Test
public void mixin_class_names_remembered_in_order_added() {
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);
fred.addMixin("zip.zop.Zoom");
fred.addMixin("foo.bar.Baz");
assertEquals(fred.getMixinClassNames(), Arrays.asList("zip.zop.Zoom", "foo.bar.Baz"));
verify();
}
Aggregations