You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2017/07/16 19:33:00 UTC
[jira] [Resolved] (CAMEL-11543) Camel doesn't support
@TestPropertySource
[ https://issues.apache.org/jira/browse/CAMEL-11543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-11543.
---------------------------------
Resolution: Fixed
Assignee: Claus Ibsen
Fix Version/s: 2.20.0
Thanks for the contribution
> 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
> Assignee: Claus Ibsen
> Labels: spring
> Fix For: 2.20.0
>
>
> 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)