截至昨天,我的所有測試都在運行,現(xiàn)在我的擴展 BaseSpringBootTest 類的測試失敗了。測試應(yīng)用程序類@SpringBootTest//@PropertySource(value = "classpath*:override.properties", ignoreResourceNotFound = true)//@ImportResource("classpath*:applicationContext.xml")@ComponentScan("com.myorg")public class TestApplication { public static void main(String[] args) { SpringApplication.run(TestApplication.class, args); }}BaseSpringBootTest.class@RunWith(SpringRunner.class)@SpringBootTest()@ActiveProfiles("test")public abstract class BaseSpringBootTest { @Resource protected DomainOntology domainOntology; @Before public void before() throws InterruptedException, JAXBException, IOException { domainOntology.initializeCacheIfNeeded(); ; }}測試拋出錯誤public class CacheFormatterTest extends BaseSpringBootTest { @Resource CacheFormatter cf; SpelEvaluator spel = new SpelEvaluator(); @Test public void testFormatWithMockedRecordGenerator() throws IOException {我期望它能夠達到并運行此測試,但它似乎無法初始化。它昨天還在運行,我似乎不知道是什么讓它停止了。
1 回答

catspeake
TA貢獻1111條經(jīng)驗 獲得超0個贊
找到我的 @SpringBootApplication 類時遇到問題,我繼續(xù)將該類移動到根目錄中,因為它正在我的測試包上方的包中查找它。
添加回答
舉報
0/150
提交
取消