Commit 075a745e authored by Andy Wilkinson's avatar Andy Wilkinson

Polish "Allow properties to be configured using slice test annotations"

Closes gh-14052
parent 0cf1749e
...@@ -403,8 +403,10 @@ sensible overriding of values. Properties are considered in the following order: ...@@ -403,8 +403,10 @@ sensible overriding of values. Properties are considered in the following order:
on your home directory (`~/.spring-boot-devtools.properties` when devtools is active). on your home directory (`~/.spring-boot-devtools.properties` when devtools is active).
. {spring-javadoc}/test/context/TestPropertySource.{dc-ext}[`@TestPropertySource`] . {spring-javadoc}/test/context/TestPropertySource.{dc-ext}[`@TestPropertySource`]
annotations on your tests. annotations on your tests.
. {dc-spring-boot-test}/context/SpringBootTest.{dc-ext}[`@SpringBootTest#properties`] . `properties` attribute on your tests. Available on
annotation attribute on your tests. {dc-spring-boot-test}/context/SpringBootTest.{dc-ext}[`@SpringBootTest`] and the
<<boot-features-testing-spring-boot-applications-testing-autoconfigured-tests,test
annotations for testing a particular slice of your application>>.
. Command line arguments. . Command line arguments.
. Properties from `SPRING_APPLICATION_JSON` (inline JSON embedded in an environment . Properties from `SPRING_APPLICATION_JSON` (inline JSON embedded in an environment
variable or system property). variable or system property).
......
...@@ -68,6 +68,7 @@ public @interface DataLdapTest { ...@@ -68,6 +68,7 @@ public @interface DataLdapTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class DataLdapTestContextBootstrapper extends SpringBootTestContextBootstrapper { class DataLdapTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
DataLdapTest annotation = getDataLdapTestAnnotation(testClass); DataLdapTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataLdapTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private DataLdapTest getDataLdapTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, DataLdapTest.class);
}
} }
...@@ -69,6 +69,7 @@ public @interface DataMongoTest { ...@@ -69,6 +69,7 @@ public @interface DataMongoTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class DataMongoTestContextBootstrapper extends SpringBootTestContextBootstrapper { class DataMongoTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
DataMongoTest annotation = getDataMongoTestAnnotation(testClass); DataMongoTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataMongoTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private DataMongoTest getDataMongoTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, DataMongoTest.class);
}
} }
...@@ -72,6 +72,7 @@ public @interface DataNeo4jTest { ...@@ -72,6 +72,7 @@ public @interface DataNeo4jTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class DataNeo4jTestContextBootstrapper extends SpringBootTestContextBootstrapper { class DataNeo4jTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
DataNeo4jTest annotation = getDataNeo4jTestAnnotation(testClass); DataNeo4jTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataNeo4jTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private DataNeo4jTest getDataNeo4jTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, DataNeo4jTest.class);
}
} }
...@@ -65,6 +65,7 @@ public @interface DataRedisTest { ...@@ -65,6 +65,7 @@ public @interface DataRedisTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class DataRedisTestContextBootstrapper extends SpringBootTestContextBootstrapper { class DataRedisTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
DataRedisTest annotation = getDataRedisTestAnnotation(testClass); DataRedisTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataRedisTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private DataRedisTest getDataRedisTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, DataRedisTest.class);
}
} }
...@@ -81,6 +81,7 @@ public @interface JdbcTest { ...@@ -81,6 +81,7 @@ public @interface JdbcTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class JdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper { class JdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
JdbcTest annotation = getJdbcAnnotation(testClass); JdbcTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
JdbcTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private JdbcTest getJdbcAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, JdbcTest.class);
}
} }
...@@ -72,6 +72,7 @@ public @interface JooqTest { ...@@ -72,6 +72,7 @@ public @interface JooqTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class JooqTestContextBootstrapper extends SpringBootTestContextBootstrapper { class JooqTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
JooqTest annotation = getJooqTestAnnotation(testClass); JooqTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
JooqTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private JooqTest getJooqTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, JooqTest.class);
}
} }
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -51,6 +51,7 @@ import org.springframework.test.context.BootstrapWith; ...@@ -51,6 +51,7 @@ import org.springframework.test.context.BootstrapWith;
* {@link AutoConfigureJsonTesters @AutoConfigureJsonTesters} annotation. * {@link AutoConfigureJsonTesters @AutoConfigureJsonTesters} annotation.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Artsiom Yudovin
* @see AutoConfigureJson * @see AutoConfigureJson
* @see AutoConfigureJsonTesters * @see AutoConfigureJsonTesters
* @see AutoConfigureCache * @see AutoConfigureCache
...@@ -73,6 +74,7 @@ public @interface JsonTest { ...@@ -73,6 +74,7 @@ public @interface JsonTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class JsonTestContextBootstrapper extends SpringBootTestContextBootstrapper { class JsonTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
JsonTest annotation = getJsonTestAnnotation(testClass); JsonTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
JsonTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private JsonTest getJsonTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, JsonTest.class);
}
} }
...@@ -85,6 +85,7 @@ public @interface DataJpaTest { ...@@ -85,6 +85,7 @@ public @interface DataJpaTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class DataJpaTestContextBootstrapper extends SpringBootTestContextBootstrapper { class DataJpaTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
DataJpaTest annotation = getDataJpaAnnotation(testClass); DataJpaTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataJpaTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private DataJpaTest getDataJpaAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, DataJpaTest.class);
}
} }
...@@ -81,6 +81,7 @@ public @interface RestClientTest { ...@@ -81,6 +81,7 @@ public @interface RestClientTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -25,16 +25,13 @@ import org.springframework.test.context.TestContextBootstrapper;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class RestClientTestContextBootstrapper extends SpringBootTestContextBootstrapper { class RestClientTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
RestClientTest annotation = getRestClientAnnotation(testClass); RestClientTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
RestClientTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private RestClientTest getRestClientAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, RestClientTest.class);
}
} }
...@@ -88,6 +88,7 @@ public @interface WebFluxTest { ...@@ -88,6 +88,7 @@ public @interface WebFluxTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -28,7 +28,7 @@ import org.springframework.test.context.TestContextBootstrapper; ...@@ -28,7 +28,7 @@ import org.springframework.test.context.TestContextBootstrapper;
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstrapper { class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected MergedContextConfiguration processMergedContextConfiguration( protected MergedContextConfiguration processMergedContextConfiguration(
...@@ -39,12 +39,9 @@ public class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstr ...@@ -39,12 +39,9 @@ public class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstr
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
WebFluxTest annotation = getWebFluxTestAnnotation(testClass); WebFluxTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
WebFluxTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private WebFluxTest getWebFluxTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, WebFluxTest.class);
}
} }
...@@ -90,6 +90,7 @@ public @interface WebMvcTest { ...@@ -90,6 +90,7 @@ public @interface WebMvcTest {
* Properties in form {@literal key=value} that should be added to the Spring * Properties in form {@literal key=value} that should be added to the Spring
* {@link Environment} before the test runs. * {@link Environment} before the test runs.
* @return the properties to add * @return the properties to add
* @since 2.1.0
*/ */
String[] properties() default {}; String[] properties() default {};
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -28,7 +28,7 @@ import org.springframework.test.context.web.WebMergedContextConfiguration; ...@@ -28,7 +28,7 @@ import org.springframework.test.context.web.WebMergedContextConfiguration;
* @author Phillip Webb * @author Phillip Webb
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
public class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstrapper { class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstrapper {
@Override @Override
protected MergedContextConfiguration processMergedContextConfiguration( protected MergedContextConfiguration processMergedContextConfiguration(
...@@ -39,12 +39,9 @@ public class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstra ...@@ -39,12 +39,9 @@ public class WebMvcTestContextBootstrapper extends SpringBootTestContextBootstra
@Override @Override
protected String[] getProperties(Class<?> testClass) { protected String[] getProperties(Class<?> testClass) {
WebMvcTest annotation = getWebMvcTestAnnotation(testClass); WebMvcTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
WebMvcTest.class);
return (annotation != null) ? annotation.properties() : null; return (annotation != null) ? annotation.properties() : null;
} }
private WebMvcTest getWebMvcTestAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, WebMvcTest.class);
}
} }
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link DataLdapTest}. * Tests for the {@link DataLdapTest#properties properties} attribute of
* {@link DataLdapTest @DataLdapTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DataLdapTest(properties = "spring.profiles.active=test") @DataLdapTest(properties = "spring.profiles.active=test")
public class DataLdapTestEnvironmentPropertiesTests { public class DataLdapTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link DataMongoTest}. * Tests for the {@link DataMongoTest#properties properties} attribute of
* {@link DataMongoTest @DataMongoTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DataMongoTest(properties = "spring.profiles.active=test") @DataMongoTest(properties = "spring.profiles.active=test")
public class DataMongoTestEnvironmentPropertiesTests { public class DataMongoTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,14 +32,15 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -32,14 +32,15 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link DataNeo4jTest}. * Tests for the {@link DataNeo4jTest#properties properties} attribute of
* {@link DataNeo4jTest @DataNeo4jTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration(initializers = DataNeo4jTestEnvironmentPropertiesTests.Initializer.class) @ContextConfiguration(initializers = DataNeo4jTestPropertiesIntegrationTests.Initializer.class)
@DataNeo4jTest(properties = "spring.profiles.active=test") @DataNeo4jTest(properties = "spring.profiles.active=test")
public class DataNeo4jTestEnvironmentPropertiesTests { public class DataNeo4jTestPropertiesIntegrationTests {
@ClassRule @ClassRule
public static Neo4jContainer neo4j = new Neo4jContainer(); public static Neo4jContainer neo4j = new Neo4jContainer();
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,14 +32,15 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -32,14 +32,15 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link DataRedisTest}. * Tests for the {@link DataRedisTest#properties properties} attribute of
* {@link DataRedisTest @DataRedisTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration(initializers = DataRedisTestEnvironmentPropertiesTests.Initializer.class) @ContextConfiguration(initializers = DataRedisTestPropertiesIntegrationTests.Initializer.class)
@DataRedisTest(properties = "spring.profiles.active=test") @DataRedisTest(properties = "spring.profiles.active=test")
public class DataRedisTestEnvironmentPropertiesTests { public class DataRedisTestPropertiesIntegrationTests {
@ClassRule @ClassRule
public static RedisContainer redis = new RedisContainer(); public static RedisContainer redis = new RedisContainer();
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link JdbcTest}. * Tests for the {@link JdbcTest#properties properties} attribute of
* {@link JdbcTest @JdbcTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@JdbcTest(properties = "spring.profiles.active=test") @JdbcTest(properties = "spring.profiles.active=test")
public class JdbcTestEnvironmentPropertiesTests { public class JdbcTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link JooqTest}. * Tests for the {@link JooqTest#properties properties} attribute of
* {@link JooqTest @JooqTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@JooqTest(properties = "spring.profiles.active=test") @JooqTest(properties = "spring.profiles.active=test")
public class JooqTestEnvironmentPropertiesTests { public class JooqTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link JsonTest}. * Tests for the {@link JsonTest#properties properties} attribute of
* {@link JsonTest @JsonTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@JsonTest(properties = "spring.profiles.active=test") @JsonTest(properties = "spring.profiles.active=test")
public class JsonTestEnvironmentPropertiesTests { public class JsonTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link DataJpaTest}. * Tests for the {@link DataJpaTest#properties properties} attribute of
* {@link DataJpaTest @DataJpaTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DataJpaTest(properties = "spring.profiles.active=test") @DataJpaTest(properties = "spring.profiles.active=test")
public class DataJpaTestEnvironmentPropertiesTests { public class DataJpaTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link RestClientTest}. * Tests for the {@link RestClientTest#properties properties} attribute of
* {@link RestClientTest @RestClientTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@RestClientTest(properties = "spring.profiles.active=test") @RestClientTest(properties = "spring.profiles.active=test")
public class RestClientTestEnvironmentPropertiesTests { public class RestClientTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link WebFluxTest}. * Tests for the {@link WebFluxTest#properties properties} attribute of
* {@link WebFluxTest @WebFluxTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebFluxTest(properties = "spring.profiles.active=test") @WebFluxTest(properties = "spring.profiles.active=test")
public class WebFluxTestEnvironmentPropertiesTests { public class WebFluxTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -26,13 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Add properties to {@link Environment} via {@link WebMvcTest}. * Tests for the {@link WebMvcTest#properties properties} attribute of
* {@link WebMvcTest @WebMvcTest}.
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebMvcTest(properties = "spring.profiles.active=test") @WebMvcTest(properties = "spring.profiles.active=test")
public class WebMvcTestEnvironmentPropertiesTests { public class WebMvcTestPropertiesIntegrationTests {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment