### Question:
GraphQLBeanPostProcessor implements BeanPostProcessor, ApplicationContextAware { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof GraphQLApiType) { MeterRegistry registry = applicationContext.getBean(MeterRegistry.class); Class<?>[] interfaces = bean.getClass().getInterfaces(); GraphQLMetricHandler handler = new GraphQLMetricHandler(bean, registry); log.debug("Proxying {} with GraphQLMetricHandler", beanName); bean = newProxyInstance(GraphQLMetricHandler.class.getClassLoader(), interfaces, handler); } return bean; }  @Override Object postProcessAfterInitialization(Object bean, String beanName);  }### Answer:
@Test public void notGraphQLApiType() { Object bean = "notGraphQLApiType"; Object result = underTest.postProcessAfterInitialization(bean, "beanName"); assertThat(result, is(bean)); }
@Test public void graphQLApiType() { when(applicationContext.getBean(MeterRegistry.class)).thenReturn(registry); Object bean = new DomainQueryImpl(null); Object result = underTest.postProcessAfterInitialization(bean, "beanName"); GraphQLMetricHandler handler = (GraphQLMetricHandler) Proxy.getInvocationHandler(result); assertThat(handler.getDelegate(), is(bean)); assertThat(handler.getRegistry(), is(registry)); }