TabGenerator { public void stop() { inst.getTable(METADATA_TABLE_NAME).removeEntryListener(tabsListener); inst.removeEntryListener(metadataListener); inst.removeEntryListener(dataListener); } TabGenerator(NetworkTableInstance inst, Components componentRegistry); void start(); void stop(); TabStructure getStructure(); static final String ROOT_TABLE_NAME; static final String METADATA_TABLE_NAME; static final String PREF_COMPONENT_ENTRY_NAME; static final String PROPERTIES_TABLE_NAME; static final String TABS_ENTRY_KEY; static final String TABS_ENTRY_PATH; static final String POSITION_ENTRY_NAME; static final String SIZE_ENTRY_NAME; static final String SELECTED_ENTRY_NAME; static final String TAB_TYPE; static final String LAYOUT_TYPE; }
@Test public void testStop() { generator.start(); rootMetaTable.getEntry(TabGenerator.TABS_ENTRY_KEY).setStringArray(new String[]{"Foo"}); waitForNtUpdate(); TabStructure tabs = generator.getStructure(); assertAll( () -> assertEquals(1, tabs.getTabs().size()), () -> assertTrue(tabs.getTabs().containsKey("Foo")) ); generator.stop(); rootMetaTable.getEntry(TabGenerator.TABS_ENTRY_KEY).setStringArray(new String[]{"Foo", "Bar"}); waitForNtUpdate(); assertAll( () -> assertEquals(1, tabs.getTabs().size()), () -> assertTrue(tabs.getTabs().containsKey("Foo")) ); }