Update CLI test auto-configuration to 1.4's new test infrastructure

Closes gh-6973
This commit is contained in:
Andy Wilkinson
2016-09-21 15:15:35 +01:00
parent be78dc4b99
commit fc0d4e45a5
5 changed files with 18 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,6 +69,7 @@ public class SpringBootCompilerAutoConfiguration extends CompilerAutoConfigurati
"org.springframework.boot.context.properties.ConfigurationProperties",
"org.springframework.boot.context.properties.EnableConfigurationProperties",
"org.springframework.boot.autoconfigure.EnableAutoConfiguration",
"org.springframework.boot.autoconfigure.SpringBootApplication",
"org.springframework.boot.context.properties.ConfigurationProperties",
"org.springframework.boot.context.properties.EnableConfigurationProperties");
imports.addStarImports("org.springframework.stereotype",

View File

@@ -41,8 +41,7 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati
@Override
public boolean matches(ClassNode classNode) {
return AstUtils.hasAtLeastOneAnnotation(classNode,
"SpringApplicationConfiguration");
return AstUtils.hasAtLeastOneAnnotation(classNode, "SpringBootTest");
}
@Override
@@ -66,8 +65,10 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati
@Override
public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
imports.addStarImports("org.junit.runner", "org.springframework.boot.test",
"org.springframework.http", "org.springframework.test.context.junit4",
"org.springframework.test.annotation")
.addImports("org.springframework.test.context.web.WebAppConfiguration");
"org.springframework.boot.test.context",
"org.springframework.boot.test.web.client", "org.springframework.http",
"org.springframework.test.context.junit4",
"org.springframework.test.annotation").addImports(
"org.springframework.boot.test.context.SpringBootTest.WebEnvironment");
}
}