JUnit throws java.lang.NoSuchMethodError For com.google.common.collect.Iterables.tryFind

懵懂的女人 提交于 2019-11-29 10:50:33

This sort of error is usually caused by having an older version of Guava (or even google-collections) on the classpath in addition to the newer version you're trying to use. Try to check what's on the classpath when running your test.

Go with Colin's answer, here's a nice way to detect where the stuff is loaded:

System.out.println(
    Iterables.class.getProtectionDomain().getCodeSource().getLocation()
);

This should print out the path to the guava (or g-c) version you are using.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!