### Question:
ConfigKey { @SuppressWarnings("unchecked") public <T> Class<? extends T> getClass(Configuration conf, Class<T> interfaceCls) { checkArgument(type() == Type.CLASS, "'" + name() + "' is NOT a CLASS setting"); try { Class<? extends T> defaultClass = (Class<? extends T>) defaultValue(); return ReflectionUtils.getClass(conf, name(), defaultClass, interfaceCls, getClass().getClassLoader()); } catch (ConfigurationException e) { throw new IllegalArgumentException("Invalid class is set to setting '" + name() + "': ", e); } }  static ConfigKeyBuilder builder(String name); @Override boolean equals(Object o); @Override int hashCode(); void validate(Configuration conf); void set(Configuration conf, Object value); long getLong(Configuration conf); int getInt(Configuration conf); short getShort(Configuration conf); boolean getBoolean(Configuration conf); double getDouble(Configuration conf); String getString(Configuration conf); @SuppressWarnings("unchecked") Class<? extends T> getClass(Configuration conf, Class<T> interfaceCls); @SuppressWarnings("unchecked") Class<?> getClass(Configuration conf); @SuppressWarnings("unchecked") List<Object> getList(Configuration conf); Object get(Configuration conf); static final Comparator<ConfigKey> ORDERING; }### Answer:
@Test public void testGetClass() { String keyName = runtime.getMethodName(); Class defaultClass = TestFunctionA.class; ConfigKey key = ConfigKey.builder(keyName) .required(true) .type(Type.CLASS) .defaultValue(defaultClass) .build(); Configuration conf = new CompositeConfiguration(); assertEquals(defaultClass, key.getClass(conf)); assertEquals(defaultClass, key.get(conf)); Class newClass = TestFunctionB.class; key.set(conf, newClass); assertEquals(newClass, key.getClass(conf)); assertEquals(newClass, key.get(conf)); String newClassName = TestFunctionC.class.getName(); conf.setProperty(key.name(), newClassName); assertEquals(TestFunctionC.class, key.getClass(conf)); assertEquals(TestFunctionC.class, key.get(conf)); }