@Test
public void shouldBindMultipleModelValuesOnlyThroughExpression()
{
// given
ModelForTests model = new ModelForTests();
ModelForTests output = new ModelForTests();
MultipleValuesExpression nameFormatter = new MultipleValuesExpression<Object[], String>()
{
@Expressive
public String fullName(String name, String surname)
{
return name + ' ' + surname;
}
};
bind().valueOf(model, ModelForTests.NAME, ModelForTests.SURNAME).through(nameFormatter).to(output, ModelForTests.NAME);
// when
model.setName("John");
model.setSurname("Smith");
// then
assertEquals("John Smith", output.getName());
}