zoukankan      html  css  js  c++  java
  • ssm框架问题1:@RunWith(SpringJUnit4ClassRunner.class)没有可用的导入包

    I have a JUnit 4 test class in Eclipse Ganymede that has the following annotations :

    I have a JUnit 4 test class in Eclipse Ganymede that has the following annotations :

    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations = {"classpath:/applicationContext.xml"})
    public class TestSybaseDao extends TestCase {

    This annotation gives compilation error "Type mismatch: cannot convert from Class<SpringJUnit4ClassRunner> to Class<? extends Runner>

    在写单元测试的时候,明明包导进去了但是鼠标放到调用类还会出现这个错误。

    出现这种情况一般有2个原因:

    1.可能刚加进去的包为加载到,需要到重构配置窗口中重新加载下所有包,一般eclipse自带的是junit4.4版本的。

    2.第二种原因是spring不支持junit4.5一下的版本。所以只需要把junit4.4或者更低版本升级到更高就ok了。

  • 相关阅读:
    mysql批量导入删除
    sql查重去除id最小值
    Rest构建分布式 SpringCloud微服务架构项目
    Django模板语言及视图
    Django模板语言
    面向对象进阶
    初识面向对象
    os模块和sys模块
    random模
    时间模块
  • 原文地址:https://www.cnblogs.com/flafly/p/5872518.html
Copyright © 2011-2022 走看看