### Question:
OptionsEnabledModel { public void update() { for (Option<E> selected : d_selectModel.getOptions()) { boolean enabled = optionShouldBeEnabled(selected.item); if (getEnabledModel(selected.item) != null) { getEnabledModel(selected.item).setValue(enabled); } if (!enabled && selected.toggle.getValue()) { selected.toggle.setValue(false); } } } OptionsEnabledModel(SelectableOptionsModel<E> selectModel, boolean listenToSelection); abstract boolean optionShouldBeEnabled(E option); void update(); ValueHolder<Boolean> getEnabledModel(E option);  }### Answer:
@Test public void testDeselectOnDisable() { final List<String> allowed = new ArrayList<String>(Arrays.asList("pick1", "icepick")); d_enabled = new OptionsEnabledModel<String>(d_select, true) { public boolean optionShouldBeEnabled(String option) { return allowed.contains(option); } }; d_select.getSelectedModel("pick1").setValue(true); d_select.getSelectedModel("icepick").setValue(true); allowed.remove("icepick"); d_enabled.update(); assertFalse(d_select.getSelectedModel("icepick").getValue()); }