### Question:
InstanceOfValidator implements ConfigDef.Validator { @Override public void ensureValid(String name, Object obj) { if (obj instanceof Class && parent.isAssignableFrom((Class<?>) obj)) { return; } throw new ConfigException(name, obj, "Class must extend: " + parent); } InstanceOfValidator(Class<?> parent); @Override void ensureValid(String name, Object obj); @Override String toString();  }### Answer:
@Test public void ensureValidTest_sameClass() { validator.ensureValid("test", TestClass.class); }
@Test public void ensureValidTest_subclass() { validator.ensureValid("test", TestSubClass.class); }
@Test(expected = ConfigException.class) public void ensureValidTest_wrongClass() { validator.ensureValid("test", Object.class); }
@Test(expected = ConfigException.class) public void ensureValidTest_notAClass() { validator.ensureValid("test", new Object()); }