Change SearchStrategy EXHAUSTIVE to TYPE_HIERARCHY

Fixup references following upstream Spring Framework change.
This commit is contained in:
Phillip Webb
2019-07-31 15:09:54 +01:00
parent 5926547767
commit da4f436140
17 changed files with 23 additions and 22 deletions

View File

@@ -41,7 +41,7 @@ class ImportsContextCustomizerFactory implements ContextCustomizerFactory {
@Override
public ContextCustomizer createContextCustomizer(Class<?> testClass,
List<ContextConfigurationAttributes> configAttributes) {
if (MergedAnnotations.from(testClass, SearchStrategy.EXHAUSTIVE).isPresent(Import.class)) {
if (MergedAnnotations.from(testClass, SearchStrategy.TYPE_HIERARCHY).isPresent(Import.class)) {
assertHasNoBeanMethods(testClass);
return new ImportsContextCustomizer(testClass);
}

View File

@@ -151,7 +151,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
* @see SpringApplication#run(String...)
*/
protected String[] getArgs(MergedContextConfiguration config) {
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.EXHAUSTIVE).get(SpringBootTest.class)
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.TYPE_HIERARCHY).get(SpringBootTest.class)
.getValue("args", String[].class).orElse(NO_ARGS);
}
@@ -215,7 +215,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
}
private boolean isEmbeddedWebEnvironment(MergedContextConfiguration config) {
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.EXHAUSTIVE).get(SpringBootTest.class)
return MergedAnnotations.from(config.getTestClass(), SearchStrategy.TYPE_HIERARCHY).get(SpringBootTest.class)
.getValue("webEnvironment", WebEnvironment.class).orElse(WebEnvironment.NONE).isEmbedded();
}

View File

@@ -196,7 +196,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
* @since 2.1.6
*/
protected String determineResourceBasePath(MergedContextConfiguration configuration) {
return MergedAnnotations.from(configuration.getTestClass(), SearchStrategy.EXHAUSTIVE)
return MergedAnnotations.from(configuration.getTestClass(), SearchStrategy.TYPE_HIERARCHY)
.get(WebAppConfiguration.class).getValue(MergedAnnotation.VALUE, String.class)
.orElse("src/main/webapp");
}