junit失败,但在通过maven命令行运行时通过
我的junit失败,但在通过maven命令行运行时通过,maven,junit,Maven,Junit,我的junit在使用eclipse运行时失败。但是当我使用maven命令行运行时,它成功了 java.lang.ClassCastException: org.springframework.security.core.authority.GrantedAuthorityImpl cannot be cast to java.lang.Comparable at java.util.TreeMap.compare(Unknown Source) at java.util.Tree
junit
在使用eclipse
运行时失败。但是当我使用maven
命令行运行时,它成功了
java.lang.ClassCastException: org.springframework.security.core.authority.GrantedAuthorityImpl cannot be cast to java.lang.Comparable
at java.util.TreeMap.compare(Unknown Source)
at java.util.TreeMap.put(Unknown Source)
at java.util.TreeSet.add(Unknown Source)
当缺少依赖项(jar文件)或类路径/lib文件夹中存在重复项时,这些类型的ClassCastException通常会出现。请检查eclipse运行测试的文件夹中是否有重复/丢失的jar文件。在我的例子中,这是jre的问题。我从jre7改为jre6(我的项目jre),它成功了。检查Spring依赖项。我认为这个错误可能是由库冲突引起的。。