TabModelImpl implements TabModel { @Override public LayoutModel getLayout(String path, String layoutType) { LayoutModel layout = layouts.computeIfAbsent(path, p -> new LayoutModelImpl(p, this, layoutType)); children.put(path, layout); return layout; } 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 testGetLayout() { TabModel tab = new TabModelImpl("Tab"); String path = "/Shuffleboard/Tab/List"; LayoutModel layout = tab.getLayout(path, "List Layout"); assertAll( () -> assertSame(layout, tab.getChild(path)), () -> assertSame(layout, tab.getChildren().get(path)) ); }
@Test public void testGetOrCreateExistingLayout() { TabModel tab = new TabModelImpl("Tab"); tab.getLayout("/", ""); assertThrows(IllegalArgumentException.class, () -> tab.getOrCreate("/", null, null, null)); }