Spring Boot测试抛出找不到文档异常

时间:2018-06-22 20:41:08

标签: java spring-boot mockito spring-boot-test

我有这堂课

@Configuration
@EnableConfigurationProperties(value = {XYZ.class})
@ImportResource(locations = {"classpath:/spring/test/spring-config.xml"})
public class **MyClassConfig**{
}

并有这个测试班

@ActiveProfiles("test_configuration")
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = { **MyClassConfig**.class})
public class MyClassTest {
 public void test(){
 .... 
 ....
 ......
 }
}

当我运行测试时,它在下面抛出我错误 schema_reference.4: Failed to read schema document 'http://www.mockito.org/spring/mockito.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

我的配置文件中包含以下内容

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:mockito="http://www.mockito.org/spring/mockito"
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.mockito.org/spring/mockito http://www.mockito.org/spring/mockito.xsd
                         http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd">

0 个答案:

没有答案