TabModelImpl implements TabModel { @Override public Map<String, Object> getProperties() { return properties; } TabModelImpl(String title); @Override String getTitle(); @Override Map<String, Object> getProperties(); @Override void setProperties(Map<String, Object> properties); @Override LayoutModel getLayout(String path, String layoutType); @Override ComponentModel getChild(String path); @Override void addChild(ComponentModel component); @Override Map<String, ComponentModel> getChildren();  }
@Test public void testGetOrCreateUpdatesExistingWidget() { TabModel tab = new TabModelImpl("Tab"); WidgetModel widget = tab.getOrCreate("/", DataSource::none, "", Collections.emptyMap()); Map<String, Object> newProperties = new HashMap<>(); newProperties.put("foo", "bar"); WidgetModel second = tab.getOrCreate("/", DataSource::none, "List", newProperties); assertAll("Updates", () -> assertSame(widget, second, "Second getOrCreate returned a different object"), () -> assertEquals("List", widget.getDisplayType()), () -> assertEquals(newProperties, widget.getProperties()) ); }