Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot @SpringBootTest在maven测试运行时不会失败,而它应该失败_Spring Boot_Maven_Testing - Fatal编程技术网

Spring boot @SpringBootTest在maven测试运行时不会失败,而它应该失败

Spring boot @SpringBootTest在maven测试运行时不会失败,而它应该失败,spring-boot,maven,testing,Spring Boot,Maven,Testing,我编写了一个测试来测试SpringBoot启动-验证上下文和所有依赖项是否都已就绪: package com.beezer.service.triggers; import lombok.extern.log4j.Log4j2; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.spring

我编写了一个测试来测试SpringBoot启动-验证上下文和所有依赖项是否都已就绪:

package com.beezer.service.triggers;

import lombok.extern.log4j.Log4j2;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest (classes = TriggersServiceApplication.class)
@Log4j2
public class SpringContextTest {

    @Test
    public void contextLoads() {
        log.info("SpringContextTest is running");
    }
}
为了测试它,我删除了一个必要的上下文——当手动运行它时,测试会像预期的那样失败,但是当我使用Maven的clean install在整个项目上运行clean install时,测试会成功

你能根据你的经验告诉我为什么它没有失败吗

致意 卡梅尔