JUnit +Spring注解 单元测试配置
?
4.现在,我们想要通过Junit对CostStatService?中的功能进行单元测试,配置如下:
?
? ? ?@RunWith(SpringJUnit4ClassRunner.class) ?
? ? ?@ContextConfiguration("classpath:applicationContext.xml")
? ? ?public class AgentManageTest {
? ? ? ? ? ? ? ? @Autowired
? ? ? ?private CostStatService costStatService;
? ? ? }
?
? ?简单的三行,就可以对costStatService进行单测了
?
? ??
? ??