### Question:
DateFieldBindingDefinition implements BindingDefinition { @Override public Component newComponent() { DateField dateField = ComponentFactory.newDateField(); if (StringUtils.isNotBlank(uiDateField.dateFormat())) { dateField.setDateFormat(uiDateField.dateFormat()); } else { Locale locale = UiFramework.getLocale(); dateField.setDateFormat(DateFormats.getPattern(locale)); } return dateField; } DateFieldBindingDefinition(UIDateField uiDateField); @Override Component newComponent(); @Override String label(); @Override EnabledType enabled(); @Override RequiredType required(); @Override VisibleType visible(); @Override String modelAttribute(); @Override String modelObject();  }### Answer:
@Test public void testNewComponent_DefaultDateFormatIsUsed() { assertThat(UiFramework.getLocale(), is(Locale.GERMAN)); DateFieldBindingDefinition adapter = new DateFieldBindingDefinition(defaultAnnotation()); Component component = adapter.newComponent(); assertThat(component, is(instanceOf(DateField.class))); DateField dateField = (DateField)component; assertThat(dateField.getDateFormat(), is(DateFormats.PATTERN_DE)); }
@Test public void testNewComponent_CustomDateFormatIsUsed() { DateFieldBindingDefinition adapter = new DateFieldBindingDefinition(customAnnotation()); Component component = adapter.newComponent(); assertThat(component, is(instanceOf(DateField.class))); DateField dateField = (DateField)component; assertThat(dateField.getDateFormat(), is(CUSTOM_DATE_FORMAT)); }