Methods Summary |
---|
private static void | assertPropertyOutput(java.lang.String expectedOutput, Property property)
final StringWriter out = new StringWriter();
assertTrue(property.start(out));
assertEquals(expectedOutput, out.getBuffer().toString());
|
public void | testDefaultShouldBeOutputIfBeanNotAvailable()
final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("foo");
assertPropertyOutput("default", property);
|
public void | testDefaultShouldBeOutputIfPropertyIsNull()
final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
stack.push(new FooBar(null, "bar-value"));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("foo");
assertPropertyOutput("default", property);
|
public void | testNormalBehaviour()
final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
stack.push(new FooBar("foo-value", "bar-value"));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("foo");
assertPropertyOutput("foo-value", property);
|
public void | testTopValueShouldReturnTopOfValueStack()
final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
stack.push(new FooBar("foo-value", "bar-value"));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("top");
assertPropertyOutput("foo-value/bar-value", property);
|
public void | testTypeConverterReturningNullShouldLeadToDisplayOfDefaultValue()
final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
Ognl.setTypeConverter(stack.getContext(), new TestDefaultConverter());
stack.push(new FooBar("foo-value", null));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("top");
assertPropertyOutput("default", property);
|
public void | testTypeConverterShouldBeUsed()
final ValueStack stack = ValueStackFactory.getFactory().createValueStack();
Ognl.setTypeConverter(stack.getContext(), new TestDefaultConverter());
stack.push(new FooBar("foo-value", "bar-value"));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("top");
assertPropertyOutput("*foo-value + bar-value*", property);
|