use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method reoder_from_annotation.
@Test
public void reoder_from_annotation() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(PropertyOrderBean.class, true, messages);
assertEquals(model.getPropertyNames(), Arrays.asList("third", "first", "second"));
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method exclude_property.
@Test
public void exclude_property() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(SimpleBean.class, true, messages);
assertSame(model.exclude("age"), model);
assertEquals(model.getPropertyNames(), Arrays.asList("firstName", "lastName"));
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method non_text_property.
@Test
public void non_text_property() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(EnumBean.class, true, messages);
assertEquals(model.getPropertyNames(), Arrays.asList("token"));
assertEquals(model.get("token").getDataType(), "enum");
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method nonvisual_properties_are_excluded.
@Test
public void nonvisual_properties_are_excluded() {
Messages messages = mockMessages();
stub_contains(messages, false);
replay();
BeanModel model = source.create(NonVisualBean.class, true, messages);
assertEquals(model.getPropertyNames(), Arrays.asList("name"));
verify();
}
use of org.apache.tapestry5.commons.Messages in project tapestry-5 by apache.
the class AbstractBeanModelSourceImplTest method add_after.
@Test
public void add_after() {
Messages messages = mockMessages();
PropertyConduit conduit = mockPropertyConduit();
Class propertyType = String.class;
stub_contains(messages, false);
expect(conduit.getPropertyType()).andReturn(propertyType).atLeastOnce();
expect(conduit.getAnnotation(EasyMock.isA(Class.class))).andStubReturn(null);
replay();
BeanModel model = source.create(SimpleBean.class, true, messages);
assertEquals(model.getPropertyNames(), Arrays.asList("firstName", "lastName", "age"));
PropertyModel property = model.add(RelativePosition.AFTER, "firstname", "middleInitial", conduit);
assertEquals(model.getPropertyNames(), Arrays.asList("firstName", "middleInitial", "lastName", "age"));
assertEquals(property.getPropertyName(), "middleInitial");
assertSame(property.getConduit(), conduit);
assertSame(property.getPropertyType(), propertyType);
verify();
}
Aggregations