读书人

JUnit +Spring注脚 单元测试配置

发布时间: 2013-04-21 15:31:38 作者: rapoo

JUnit +Spring注解 单元测试配置

?

4.现在,我们想要通过Junit对CostStatService?中的功能进行单元测试,配置如下:

?

? ? ?@RunWith(SpringJUnit4ClassRunner.class) ?

? ? ?@ContextConfiguration("classpath:applicationContext.xml")

? ? ?public class AgentManageTest {

? ? ? ? ? ? ? ? @Autowired

? ? ? ?private CostStatService costStatService;

? ? ? }

?

? ?简单的三行,就可以对costStatService进行单测了

?

? ??

? ??

读书人网 >互联网

热点推荐