Source:
public void withUrlAndTemplate() { DirectFieldAccessor endpointAccessor = new DirectFieldAccessor(this.withUrlAndTemplate); RestTemplate restTemplate = TestUtils.getPropertyValue(this.withUrlAndTemplate, "handler.restTemplate", RestTemplate.class); assertThat(restTemplate).isSameAs(customRestTemplate); HttpRequestExecutingMessageHandler handler = (HttpRequestExecutingMessageHandler) endpointAccessor .getPropertyValue("handler"); DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); assertThat(handlerAccessor.getPropertyValue("expectReply")).isEqualTo(false); assertThat(endpointAccessor.getPropertyValue("inputChannel")) .isEqualTo(this.applicationContext.getBean("requests")); assertThat(handlerAccessor.getPropertyValue("outputChannel")).isNull(); DirectFieldAccessor templateAccessor = new DirectFieldAccessor(handlerAccessor.getPropertyValue("restTemplate" )); ClientHttpRequestFactory requestFactory = (ClientHttpRequestFactory) templateAccessor.getPropertyValue("requestFactory"); assertThat(requestFactory instanceof SimpleClientHttpRequestFactory).isTrue(); Expression uriExpression = (Expression) handlerAccessor.getPropertyValue("uriExpression"); assertThat(uriExpression.getValue()).isEqualTo("http://localhost/test1"); assertThat(TestUtils.getPropertyValue(handler, "httpMethodExpression", Expression.class).getExpressionString()) .isEqualTo(HttpMethod.POST.name()); assertThat(handlerAccessor.getPropertyValue("charset")).isEqualTo(Charset.forName("UTF-8")); assertThat(handlerAccessor.getPropertyValue("extractPayload")).isEqualTo(true); Object uriVariablesExpression = handlerAccessor.getPropertyValue("uriVariablesExpression"); assertThat(uriVariablesExpression).isNotNull(); assertThat(((Expression) uriVariablesExpression).getExpressionString()).isEqualTo("@uriVariables"); Object uriVariableExpressions = handlerAccessor.getPropertyValue("uriVariableExpressions"); assertThat(uriVariableExpressions).isNotNull(); assertThat(((Map<?, ?>) uriVariableExpressions).isEmpty()).isTrue(); }

Target:
public void withUrlAndTemplate() { DirectFieldAccessor endpointAccessor = new DirectFieldAccessor(this.withUrlAndTemplate); RestTemplate restTemplate = TestUtils.getPropertyValue(this.withUrlAndTemplate, "handler.restTemplate", RestTemplate.class); assertThat(restTemplate).isSameAs(customRestTemplate); HttpRequestExecutingMessageHandler handler = (HttpRequestExecutingMessageHandler) endpointAccessor .getPropertyValue("handler"); DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); assertThat(handlerAccessor.getPropertyValue("expectReply")).isEqualTo(false); assertThat(endpointAccessor.getPropertyValue("inputChannel")) .isEqualTo(this.applicationContext.getBean("requests")); assertThat(handlerAccessor.getPropertyValue("outputChannel")).isNull(); DirectFieldAccessor templateAccessor = new DirectFieldAccessor(handlerAccessor.getPropertyValue("restTemplate")); ClientHttpRequestFactory requestFactory = (ClientHttpRequestFactory) templateAccessor.getPropertyValue("requestFactory"); assertThat(requestFactory instanceof SimpleClientHttpRequestFactory).isTrue(); Expression uriExpression = (Expression) handlerAccessor.getPropertyValue("uriExpression"); assertThat(uriExpression.getValue()).isEqualTo("http://localhost/test1"); assertThat(TestUtils.getPropertyValue(handler, "httpMethodExpression", Expression.class).getExpressionString()) .isEqualTo(HttpMethod.POST.name()); assertThat(handlerAccessor.getPropertyValue("charset")).isEqualTo(StandardCharsets.UTF_8); assertThat(handlerAccessor.getPropertyValue("extractPayload")).isEqualTo(true); Object uriVariablesExpression = handlerAccessor.getPropertyValue("uriVariablesExpression"); assertThat(uriVariablesExpression).isNotNull(); assertThat(((Expression) uriVariablesExpression).getExpressionString()).isEqualTo("@uriVariables"); Object uriVariableExpressions = handlerAccessor.getPropertyValue("uriVariableExpressions"); assertThat(uriVariableExpressions).isNotNull(); assertThat(((Map<?, ?>) uriVariableExpressions).isEmpty()).isTrue(); }