### Question:
BooleanSchema extends PrimitiveSchema { @Override public Object convert(Object value) { if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { String stringData = (String) value; stringData = stringData.toLowerCase(); if (stringData.equals("true")) { return Boolean.TRUE; } else if (stringData.equals("false")) { return Boolean.FALSE; } else { throw new IllegalArgumentException(stringData + " cannot be parsed to a boolean"); } } throw new IllegalArgumentException(value + " is not a boolean"); } BooleanSchema(); @Override Object convert(Object value);  }### Answer:
@Test public void testConvert() throws Exception { boolean value = true; Object convertedValue = this.schema.convert("" + value); assertTrue(convertedValue instanceof Boolean); Boolean convertedInput = (Boolean) convertedValue; assertTrue(convertedInput.booleanValue() == value); }
@Test(expected = IllegalArgumentException.class) public void testInvalidStringThrowsException() throws IllegalArgumentException { this.schema.convert("INVALID INPUT"); }
@Test(expected = IllegalArgumentException.class) public void testUnsupportedObjectTypeThrowsException() throws IllegalArgumentException { this.schema.convert(new Object()); }
@Test public void testBooleanConverter() { assertTrue("Failure returning same object", this.schema.convert(true).equals(Boolean.TRUE)); assertTrue("Failure returning same object", this.schema.convert(false).equals(Boolean.FALSE)); assertTrue("Failure parsing true", this.schema.convert("true").equals(Boolean.TRUE)); assertTrue("Failure parsing false", this.schema.convert("false").equals(Boolean.FALSE)); }