@Test
public void testSelectNonExistingProperty() {
StringBuilder builder = new StringBuilder();
Document document = new StringBuilderDocument(builder);
String propertyName = "pi";
Reference selected1 = createMock(Reference.class);
Reference selected2 = createMock(Reference.class);
expect(reference1.getType()).andReturn(String.class);
expect(reference2.getType()).andReturn(String.class);
expect(selected1.getType()).andReturn(String.class);
expect(reference1.getReferenceContext()).andReturn(context);
expect(reference2.getReferenceContext()).andReturn(context);
expect(reference1.selectAttribute(propertyName)).andReturn(selected1);
expect(reference2.selectAttribute(propertyName)).andThrow(new BindingException("No property pi"));
selected1.document(document);
expect(selected1.getReferenceContext()).andReturn(context);
replay(reference1, reference2, selected1, selected2);
MultiReference multi = new MultiReference(reference1, reference2);
Reference selected = multi.selectAttribute(propertyName);
assertNotNull(selected);
selected.document(document);
verify(reference1, reference2, selected1, selected2);
}