### Question:
TextPM extends AbstractValuePM implements ITextPM { public void setRestrictedToOptions(boolean restrictedToOptions) { if (this.restrictedToOptions == restrictedToOptions) { return; } this.restrictedToOptions = restrictedToOptions; revalidate(); getPropertyChangeSupport().firePropertyChange("restrictedToOptions", !this.restrictedToOptions, this.restrictedToOptions); } TextPM(String initialText);  TextPM(); String getText(); String getText(boolean convertWhitespaceStringToNull); void setText(String aText); boolean isRestrictedToOptions(); void setRestrictedToOptions(boolean restrictedToOptions); boolean isEmpty(); boolean isModified(); void reset(); void preset(); void reformat(); Options getOptions(); void setOptions(Options newOptions); @Override Comparable<?> getComparable();  }### Answer:
@Test public void setRestrictedToOptions() { TextPM pModel = new TextPM(); pModel.setRestrictedToOptions(true); Options<Integer> opt = new Options<Integer>(); opt.put(1, "one"); opt.put(2, "two"); opt.put(3, "three"); pModel.setOptions(opt); pModel.setText("one"); assertEquals("pModel.isValid()", true, pModel.isValid()); pModel.setText("blah"); assertEquals("pModel.isValid()", false, pModel.isValid()); pModel.setRestrictedToOptions(false); assertEquals("pModel.isValid()", true, pModel.isValid()); }