FeatureToggle { public boolean isEnabled() { return state.get(); } FeatureToggle(String name, AtomicBoolean state); String getName(); boolean isEnabled(); boolean setEnabled(boolean state);  }
@Test public void disabledByDefault() { try (Feature feature = newFeature("my.toggle", whiteboard)) { assertFalse(feature.isEnabled()); } }
@Test public void unregisterOnClose() { List<FeatureToggle> toggles; try (Feature feature = newFeature("my.toggle", whiteboard)) { assertFalse(feature.isEnabled()); toggles = getFeatureToggles(); assertEquals(1, toggles.size()); } toggles = getFeatureToggles(); assertThat(toggles, is(empty())); }