tyr*_*yro 8 testing spring mockito dependency-management spring-boot
我在Gradle文件中添加了Spring Boot测试依赖项
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
ext['mockito.version'] = '2.7.5'
Run Code Online (Sandbox Code Playgroud)
仍然无法使用@WebIntegrationTest
,如果我尝试添加Intellij,它会显示红色.我应该在我的应用程序中拥有什么才能使用它来测试REST API @WebIntegrationTest
?
我能够用不同的方法测试它,但却无法理解它失败的原因
har*_*vmb 11
仍然无法使用@WebIntegrationTest,如果我尝试添加intellij,它会显示红色.
正如你所说,你有springboot 1.5.1版本,WebIntegrationTest
类已经从1.4推荐为赞成使用SpringBootTest
.
下面是上面支持的javadocs.
- @since 1.2.1*@see IntegrationTest*@deprecated 1.4,支持*{@link org.springframework.boot.test.context.SpringBootTest}*{@code webEnvironment = RANDOM_PORT}或{@code webEnvironment = DEFINED_PORT }.*/@Documented @Inherited @Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@ BootstrapWith(WebAppIntegrationTestContextBootstrapper.class)@Deprecated public @interface WebIntegrationTest {
你有两个选择,
WebIntegrationTest
类并开始使用SpringBootTest
WebIntegrationTest
(不推荐)这是1.4.0-M2发行说明的链接,解释了有关的弃用WebIntegrationTest
希望这可以帮助!
归档时间: |
|
查看次数: |
5035 次 |
最近记录: |