[ https://issues.apache.org/jira/browse/CAMEL-11543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16088981#comment-16088981 ]
ASF GitHub Bot commented on CAMEL-11543: ---------------------------------------- GitHub user drekbour opened a pull request: https://github.com/apache/camel/pull/1827 CAMEL-11543 Support @TestPropertySource Only works if PropertySources are enabled obviously! You can merge this pull request into a Git repository by running: $ git pull https://github.com/drekbour/camel CAMEL-115432 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/1827.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1827 ---- commit 6c2fea4dd82ceeafb11df778b0a116b6f4187bf7 Author: Marc Carter <drekb...@fastmail.fm> Date: 2017-07-16T15:58:48Z CAMEL-11543 Support @TestPropertySource ---- > Camel doesn't support @TestPropertySource > ----------------------------------------- > > Key: CAMEL-11543 > URL: https://issues.apache.org/jira/browse/CAMEL-11543 > Project: Camel > Issue Type: Improvement > Components: camel-test > Affects Versions: 2.18.1 > Environment: Spring 4.1 onwards > Reporter: Marc Carter > Labels: spring > > Vanilla Spring test passes: > {code:java} > @RunWith(SpringJUnit4ClassRunner.class) > @ContextConfiguration(classes= PropTest.class) > @Configuration > @TestPropertySource(properties = "key=value") > public class PropTest { > @Value("${key}") private String key; > @Test > public void test() { > assertThat(key, is("value")); > } > } > {code} > Camel test fails (first two lines only changed): > {code:java} > @RunWith(CamelSpringRunner.class) > @BootstrapWith(CamelTestContextBootstrapper.class) > @ContextConfiguration(classes= PropTest.class) > @Configuration > @TestPropertySource(properties = "key=value") > public class PropTest { > @Value("${key}") private String key; > @Test > public void test() { > assertThat(key, is("value")); > } > } > {code} > This would appear to be related to the comment in > [@TestPropertySource|https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/test/context/TestPropertySource.html] > bq. @TestPropertySource is enabled if the configured context loader honors > it. Every SmartContextLoader that is a subclass of either > AbstractGenericContextLoader or AbstractGenericWebContextLoader provides > automatic support for @TestPropertySource > {{CamelSpringTestContextLoader}} does not extend AbstractGenericContextLoader > but its parent AbstractContextLoader so ignores the annotation. -- This message was sent by Atlassian JIRA (v6.4.14#64029)