【发布时间】:2021-01-16 10:52:00
【问题描述】:
我有一个 Spring 应用程序, 我已经创建了这个测试:
@RunWith(SpringRunner.class)
@SpringJUnitWebConfig(locations = {
"classpath:testDatabaseContext.xml",
"classpath:testServicesContext.xml",
"classpath:backoffice-servlet.xml"
})
public class UserControllerTests {
@Autowired
private MockMvc mockMvc;
@Before
void setup(WebApplicationContext wac) {
this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
}
..
}
但是当我开始测试时,我得到了这个错误:
rg.junit.runners.model.InvalidTestClassError: Invalid test class 'com.pastis.UserControllerTests':
1. Method setup() should be public
2. Method setup should have no parameters
【问题讨论】:
标签: java spring junit log4j dbunit