use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method default_properties_exclude_write_only.
@Test
public void default_properties_exclude_write_only() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(WriteOnlyBean.class, false, messages);
assertEquals(model.getPropertyNames(), Arrays.asList("readOnly", "readWrite"));
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method sortable_annotation.
// https://issues.apache.org/jira/browse/TAP5-2305
@Test
public void sortable_annotation() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel<SortableBean> model = source.createDisplayModel(SortableBean.class, messages);
model.add("nonSortableByDefault");
model.add("sortable");
// checking whether non-@Sortable annotated properties still behave in the old ways
assertTrue(model.get("sortableByDefault").isSortable());
assertFalse(model.get("nonSortableByDefault").isSortable());
// checking @Sortable itself
assertFalse(model.get("nonSortable").isSortable());
assertTrue(model.get("sortable").isSortable());
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method get_added_property_by_name.
@Test
public void get_added_property_by_name() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(SimpleBean.class, true, messages);
PropertyModel pm = model.addEmpty("shrub.foo()");
assertSame(model.get("Shrub.Foo()"), pm);
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method order_via_annotation.
@Test
public void order_via_annotation() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(StoogeBean.class, true, messages);
assertEquals(model.getPropertyNames(), Arrays.asList("larry", "moe", "shemp", "curly"));
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class BeanModelImpl method add.
public PropertyModel add(String propertyName, PropertyConduit conduit) {
validateNewPropertyName(propertyName);
PropertyModel propertyModel = new PropertyModelImpl(this, propertyName, conduit, messages);
properties.put(propertyName, propertyModel);
// Remember the order in which the properties were added.
propertyNames.add(propertyName);
return propertyModel;
}
Aggregations