zoukankan      html  css  js  c++  java
  • 基于spring 的单元测试

    需要引用的依赖:

    import org.junit.runner.RunWith;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

    maven依赖为:

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>3.2.3.RELEASE</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
                <scope>test</scope>
            </dependency>

    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration({ "classpath:applicationContext-springService.xml" })
    public class DistributeServiceTest {


    @Resource
    DistributeService distributeService;

      @Test
      public void testGetStatisticsByChannel() {
        long beginTime = 0;
        long endTime = 1545615321794L;
        List<Distribute> distributeInfo = new ArrayList<>(3);
        Distribute distribute = new Distribute();
        distribute.setChannelNo("1055100004");
        distributeInfo.add(distribute);
        distributeService.getStatisticsByChannel(distributeInfo, beginTime, endTime);

        Assert.assertTrue(distributeInfo.get(0).getAndroidTotal().equals("3"));
      }

        

      @Test
      public void test() {
        System.out.println(123);
      }


    }

  • 相关阅读:
    再谈iframe自适应高度
    一个软件外包老鸟对外包业的反思
    需求分析中减少客户摩擦的若干法则
    C# 进制转换
    'filter' is not a known css property name
    Ajax之ModalPopupExtender 的后台调用
    Microsoft SQL Server 中的小数数据类型
    ExtJS Combobox 如何设置默认和取值问题
    wp7 控制控件显隐
    wp7 MediaElement播放
  • 原文地址:https://www.cnblogs.com/yipihema/p/4921220.html
Copyright © 2011-2022 走看看