错误:java.lang.Exception: No tests found matching Method testPrePage1(egou_manager_web.TestEBrand) from org.junit.internal.requests.ClassRequest@4f3cc73c

今天测试分页时出现以下错误:

java.lang.Exception: No tests found matching Method testPrePage1(egou_manager_web.TestEBrand) from org.junit.internal.requests.ClassRequest@4f3cc73c
    at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.<init>(JUnit4TestMethodReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:54)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

测试代码如下:

@Test
    public void testPrePage1() {

        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("spring/applicationContext_*.xml");
        BrandService brandService = (BrandService) ac.getBean("brandService");
        EBrandExample example = new EBrandExample();
        // 执行查询,并分页
        // 分页处理
        PageHelper.startPage(2, 3);
        List<EBrand> list = brandService.selectByExample(example);
        // 取商品列表
        for (EBrand tbItem : list) {
            System.out.println(tbItem);
        }
        // 取分页信息
        PageInfo<EBrand> pageInfo = new PageInfo<EBrand>(list);
        long total = pageInfo.getTotal();
        System.out.println("共有商品:" + total);

    }

不知哪里出了问题?望高手告知~~

posted @ 2016-12-11 15:00  一棵写代码的柳树  阅读(2704)  评论(1编辑  收藏  举报