Assert.assertEquals("property1", valueBindingExpression.getProperty());
}
public void testStandardSyntaxReplaceProperty() throws Exception
{
ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.property1}");
valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");
Assert.assertEquals("#{bean1.property2}", valueBindingExpression.getExpressionString());
Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getExpressionString());
Assert.assertEquals("property2", valueBindingExpression.getProperty());
valueBindingExpression = new ValueBindingExpression("#{bean1['property1']}");
valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");
//TODO restore original syntax
Assert.assertEquals("#{bean1.property2}", valueBindingExpression.getExpressionString());
Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getExpressionString());
Assert.assertEquals("property2", valueBindingExpression.getProperty());
valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].property1}");
valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");
Assert.assertEquals("#{bean1['bean2'].property2}", valueBindingExpression.getExpressionString());
Assert.assertEquals("#{bean1['bean2']}", valueBindingExpression.getBaseExpression().getExpressionString());
Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getBaseExpression().getExpressionString());
Assert.assertEquals("property2", valueBindingExpression.getProperty());
}