### Question:
FactoryBeanExtension implements ServiceExtension { @Override public <T> DynamicType.Builder<T> interceptProxy(DynamicType.Builder<T> builder, Class<T> type) { return builder.implement(FactoryBean.class) .method(named("getObject")) .intercept(MethodCall.invoke(named("instance"))) .method(named("getObjectType")) .intercept(MethodCall.invoke(named("underlyingType"))); }  @Override DynamicType.Builder<T> interceptProxy(DynamicType.Builder<T> builder, Class<T> type);  }### Answer:
@Test public void test() throws Exception { var ext = new FactoryBeanExtension(); var bb = new ByteBuddy(); DynamicType.Builder<TestRessorService> b = bb.subclass(TestRessorService.class); var instance = ext.interceptProxy(b, TestRessorService.class) .make() .load(getClass().getClassLoader(), INJECTION) .getLoaded() .getDeclaredConstructor() .newInstance(); assertThat(instance).isInstanceOf(FactoryBean.class); assertThat(((FactoryBean) instance).getObject()).isSameAs(TestRessorService.INSTANCE); assertThat(((FactoryBean) instance).getObjectType()).isSameAs(TestRessorService.class); }