在允许TestExecutionListener时捕获了异常

时间:2018-07-04 16:41:15

标签: java spring spring-mvc spring-boot

我为项目https://github.com/JonkiPro/popcorn/tree/develop创建了项目的集成测试。我添加了带有注释的课程

@TestExecutionListeners(
    {
            DependencyInjectionTestExecutionListener.class,
            DirtiesContextTestExecutionListener.class,
            TransactionalTestExecutionListener.class,
            TransactionDbUnitTestExecutionListener.class
    }
)
public abstract class DBUnitTestBase {...}

启动测试后,他将其扔到控制台https://pastebin.com/8kC4Mkm6

lip 04, 2018 6:30:10 PM org.springframework.boot.test.context.SpringBootTestContextBootstrapper buildDefaultMergedContextConfiguration
INFO: Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.jonki.popcorn.core.jpa.service.UserPersistenceServiceImplIntegrationTests], using SpringBootContextLoader
lip 04, 2018 6:30:10 PM org.springframework.test.context.support.AbstractContextLoader generateDefaultLocations
INFO: Could not detect default resource locations for test class [com.jonki.popcorn.core.jpa.service.UserPersistenceServiceImplIntegrationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
lip 04, 2018 6:30:11 PM org.springframework.boot.test.context.SpringBootTestContextBootstrapper getTestExecutionListeners
INFO: Using TestExecutionListeners: [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@769e7ee8, org.springframework.test.context.support.DirtiesContextTestExecutionListener@5276e6b0, org.springframework.test.context.transaction.TransactionalTestExecutionListener@71b1176b, com.github.springtestdbunit.TransactionDbUnitTestExecutionListener@6193932a]

java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig
...

lip 04, 2018 6:30:12 PM org.springframework.test.context.TestContextManager prepareTestInstance
SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@769e7ee8] to prepare test instance [com.jonki.popcorn.core.jpa.service.UserPersistenceServiceImplIntegrationTests@402bba4f]
java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig

我添加了依赖项

testCompile("com.github.springtestdbunit:spring-test-dbunit:1.3.0")
testCompile("org.dbunit:dbunit:2.5.4")

0 个答案:

没有答案
相关问题