### Question:
BooleanPM extends TextPM implements IBooleanPM { public Boolean getBoolean() throws ConversionException { if (this.isEmpty()) { return null; } String strVal = this.getText(); Options<Boolean> options = this.getOptions(); try { return options.getKey(strVal); } catch (NoSuchElementException ex) { throw new ConversionException("strVal='" + strVal + "' is not a boolean", ex); } } BooleanPM(); void setBoolean(Boolean b); Boolean getBoolean(); void setDefaultBoolean(Boolean value);  }### Answer:
@Test public void getBoolean() { BooleanPM model = new BooleanPM(); model.setText(model.getOptions().get(true)); assertEquals("pM.getBoolean()", true, model.getBoolean()); model.setText(model.getOptions().get(false)); assertEquals("pM.getBoolean()", false, model.getBoolean()); model.setText(""); assertEquals("pM.getBoolean()", null, model.getBoolean()); }
@Test public void getInvalidBoolean() { BooleanPM model = new BooleanPM(); model.setText("hello"); try { model.getBoolean(); fail("expected IllegalStateException"); } catch (ConversionException ex) { } }