@Test public void testNotifyModelChanged() { doCallRealMethod().when(view).setValue(anyString()); doCallRealMethod().when(view).getValue(); doCallRealMethod().when(view).notifyModelChanged(); doCallRealMethod().when(view).setParentWidget(parent); doNothing().when(parent).notifyModelChanged(); view.setParentWidget(parent); when(view.getModel()).thenReturn(new MetaDataRow("myString", "Value")); view.notifyModelChanged(); assertEquals("Value", view.getValue()); view.notifyModelChanged(); verify(parent, times(1)).notifyModelChanged(); when(view.getModel()).thenReturn(new MetaDataRow("", "")); view.notifyModelChanged(); verify(parent, times(2)).notifyModelChanged(); when(view.getModel()).thenReturn(new MetaDataRow("myString2", "Value2")); view.notifyModelChanged(); verify(parent, times(3)).notifyModelChanged(); }
@Override public void notifyModelChanged() { String oldValue = currentValue; currentValue = getModel().toString(); currentName = getModel().getAttribute(); if (oldValue == null || !oldValue.equals(currentValue)) { parentWidget.notifyModelChanged(); } }
MetaDataListItemWidgetViewImpl implements MetaDataListItemWidgetView { @Override public void notifyModelChanged() { String oldValue = currentValue; currentValue = getModel().toString(); currentName = getModel().getAttribute(); if (oldValue == null || !oldValue.equals(currentValue)) { parentWidget.notifyModelChanged(); } } }
MetaDataListItemWidgetViewImpl implements MetaDataListItemWidgetView { @Override public void notifyModelChanged() { String oldValue = currentValue; currentValue = getModel().toString(); currentName = getModel().getAttribute(); if (oldValue == null || !oldValue.equals(currentValue)) { parentWidget.notifyModelChanged(); } }  }
MetaDataListItemWidgetViewImpl implements MetaDataListItemWidgetView { @Override public void notifyModelChanged() { String oldValue = currentValue; currentValue = getModel().toString(); currentName = getModel().getAttribute(); if (oldValue == null || !oldValue.equals(currentValue)) { parentWidget.notifyModelChanged(); } }  void setParentWidget(final MetaDataEditorWidgetView.Presenter parentWidget); @PostConstruct void init(); @Override MetaDataRow getModel(); @Override void setModel(final MetaDataRow model); @Override String getValue(); @Override void setValue(final String value); @Override void setReadOnly(final boolean readOnly); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); @Override void notifyModelChanged(); }
MetaDataListItemWidgetViewImpl implements MetaDataListItemWidgetView { @Override public void notifyModelChanged() { String oldValue = currentValue; currentValue = getModel().toString(); currentName = getModel().getAttribute(); if (oldValue == null || !oldValue.equals(currentValue)) { parentWidget.notifyModelChanged(); } }  void setParentWidget(final MetaDataEditorWidgetView.Presenter parentWidget); @PostConstruct void init(); @Override MetaDataRow getModel(); @Override void setModel(final MetaDataRow model); @Override String getValue(); @Override void setValue(final String value); @Override void setReadOnly(final boolean readOnly); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); @Override void notifyModelChanged();  }