@Test
public void shouldBindModelToFormattedValue() throws Exception
{
// given
JFormattedTextField textField = new JFormattedTextField(new DateFormatter());
ModelForTests model = new ModelForTests();
bind().valueOf(model, ModelForTests.DATE).toValueOf(textField);
Calendar calendar = Calendar.getInstance();
calendar.set(2010, Calendar.APRIL, 10);
// when
model.setDate(calendar.getTime());
// then
assertNotNull(textField.getValue());
calendar.setTime((Date) textField.getValue());
assertEquals(2010, calendar.get(Calendar.YEAR));
assertEquals(Calendar.APRIL, calendar.get(Calendar.MONTH));