@Test
public void textPropertyCanWrapTextField() {

  JTextField field = new JTextField("New Field");
  TextProperty textProperty = new TextProperty(field);
  CountListener listener = new CountListener();
  textProperty.addListener(listener);
  assertThat(textProperty.get()).isEqualTo("New Field");
  assertThat(listener.getCount()).isEqualTo(0);
  field.setText("Field text updated directly");
  assertThat(textProperty.get()).isEqualTo("Field text updated directly");
  assertThat(listener.getCount()).isEqualTo(2); // +2 here: TextField fires two events when setText is called directly (remove and insert)
  textProperty.set("Field text updated via property");
  assertThat(field.getText()).isEqualTo("Field text updated via property");
  assertThat(listener.getCount()).isEqualTo(3); // Only +1 here: Property.set hides extra validation calls
}