### Question:
ClassByImplementationBenchmark { @Benchmark public ExampleInterface benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); CallbackHelper callbackHelper = new CallbackHelper(Object.class, new Class[]{baseClass}) { protected Object getCallback(Method method) { if (method.getDeclaringClass() == baseClass) { return new FixedValue() { public Object loadObject() { return null; } }; } else { return NoOp.INSTANCE; } } }; enhancer.setCallbackFilter(callbackHelper); enhancer.setCallbacks(callbackHelper.getCallbacks()); return (ExampleInterface) enhancer.create(); }  @Setup void setup(); @Benchmark ExampleInterface baseline(); @Benchmark ExampleInterface benchmarkByteBuddy(); @Benchmark ExampleInterface benchmarkByteBuddyWithTypePool(); @Benchmark ExampleInterface benchmarkCglib(); @Benchmark ExampleInterface benchmarkJavassist(); @Benchmark ExampleInterface benchmarkJdkProxy(); static final Class<? extends ExampleInterface> BASE_CLASS; static final String DEFAULT_REFERENCE_VALUE; static final boolean DEFAULT_BOOLEAN_VALUE; static final byte DEFAULT_BYTE_VALUE; static final short DEFAULT_SHORT_VALUE; static final char DEFAULT_CHAR_VALUE; static final int DEFAULT_INT_VALUE; static final long DEFAULT_LONG_VALUE; static final float DEFAULT_FLOAT_VALUE; static final double DEFAULT_DOUBLE_VALUE; }### Answer:
@Test public void testCglibClassCreation() throws Exception { ExampleInterface instance = classByImplementationBenchmark.benchmarkCglib(); assertThat(Arrays.asList(instance.getClass().getInterfaces()), hasItem(ClassByImplementationBenchmark.BASE_CLASS)); assertThat(instance.getClass().getSuperclass(), CoreMatchers.<Class<?>>is(Object.class)); assertThat(classByImplementationBenchmark.benchmarkCglib().getClass(), not(CoreMatchers.<Class<?>>is(instance.getClass()))); assertReturnValues(instance); }