### Question:
RestTemplateBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (!(bean instanceof RestTemplate)) { return bean; } RestTemplate restTemplate = (RestTemplate) bean; addRestTemplateInterceptorIfNotPresent(restTemplate); return restTemplate; } RestTemplateBeanPostProcessor(Tracer tracer); @Override Object postProcessAfterInitialization(Object bean, String beanName);  }### Answer:
@Test @DisplayName("when processed bean is not of type RestTemplate should return object") void returnsObject() { assertThat( restTemplateBeanPostProcessor.postProcessAfterInitialization( new Object(), "testObject")) .isExactlyInstanceOf(Object.class); }
@Test @DisplayName("when processed bean is of type RestTemplate should return RestTemplate") void returnsRestTemplate() { assertThat( restTemplateBeanPostProcessor.postProcessAfterInitialization( new RestTemplate(), "testRestTemplate")) .isInstanceOf(RestTemplate.class); }
@Test @DisplayName("when processed bean is of type RestTemplate should add ONE RestTemplateInterceptor") void addsRestTemplateInterceptor() { RestTemplate restTemplate = new RestTemplate(); restTemplateBeanPostProcessor.postProcessAfterInitialization(restTemplate, "testRestTemplate"); restTemplateBeanPostProcessor.postProcessAfterInitialization(restTemplate, "testRestTemplate"); restTemplateBeanPostProcessor.postProcessAfterInitialization(restTemplate, "testRestTemplate"); assertThat( restTemplate.getInterceptors().stream() .filter(rti -> rti instanceof RestTemplateInterceptor) .count()) .isEqualTo(1); }