如果只是对某个方法测试
@Test
public void test(){
}
这里的方法返回值一定要是void,并且加@Test
junit的jar包的版本和spring的版本不匹配造成的
对工程测试要加两个注解
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-context.xml")
如果只是对某个方法测试
@Test
public void test(){
}
这里的方法返回值一定要是void,并且加@Test
junit的jar包的版本和spring的版本不匹配造成的
对工程测试要加两个注解
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-context.xml")