<bdo id='PcIj8'></bdo><ul id='PcIj8'></ul>

    <legend id='PcIj8'><style id='PcIj8'><dir id='PcIj8'><q id='PcIj8'></q></dir></style></legend>

      <small id='PcIj8'></small><noframes id='PcIj8'>

      <i id='PcIj8'><tr id='PcIj8'><dt id='PcIj8'><q id='PcIj8'><span id='PcIj8'><b id='PcIj8'><form id='PcIj8'><ins id='PcIj8'></ins><ul id='PcIj8'></ul><sub id='PcIj8'></sub></form><legend id='PcIj8'></legend><bdo id='PcIj8'><pre id='PcIj8'><center id='PcIj8'></center></pre></bdo></b><th id='PcIj8'></th></span></q></dt></tr></i><div id='PcIj8'><tfoot id='PcIj8'></tfoot><dl id='PcIj8'><fieldset id='PcIj8'></fieldset></dl></div>
        <tfoot id='PcIj8'></tfoot>

        PowerMock 抛出 NoSuchMethodError (setMockName)

        PowerMock throws NoSuchMethodError (setMockName)(PowerMock 抛出 NoSuchMethodError (setMockName))
          <tbody id='ZLOyI'></tbody>

          <i id='ZLOyI'><tr id='ZLOyI'><dt id='ZLOyI'><q id='ZLOyI'><span id='ZLOyI'><b id='ZLOyI'><form id='ZLOyI'><ins id='ZLOyI'></ins><ul id='ZLOyI'></ul><sub id='ZLOyI'></sub></form><legend id='ZLOyI'></legend><bdo id='ZLOyI'><pre id='ZLOyI'><center id='ZLOyI'></center></pre></bdo></b><th id='ZLOyI'></th></span></q></dt></tr></i><div id='ZLOyI'><tfoot id='ZLOyI'></tfoot><dl id='ZLOyI'><fieldset id='ZLOyI'></fieldset></dl></div>
        1. <tfoot id='ZLOyI'></tfoot>
            <legend id='ZLOyI'><style id='ZLOyI'><dir id='ZLOyI'><q id='ZLOyI'></q></dir></style></legend>

                <bdo id='ZLOyI'></bdo><ul id='ZLOyI'></ul>

                  <small id='ZLOyI'></small><noframes id='ZLOyI'>

                  本文介绍了PowerMock 抛出 NoSuchMethodError (setMockName)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 PowerMockito 模拟构造函数,但每次运行测试时都会出现以下错误:

                  I'm trying to mock a constructor using PowerMockito but every time I run the test I get the following error:

                  java.lang.NoSuchMethodError: org.mockito.internal.creation.MockSettingsImpl.setMockName(Lorg/mockito/mock/MockName;)Lorg/mockito/internal/creation/settings/CreationSettings;
                  at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:107)
                  at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:60)
                  at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.createNewSubstituteMock(DefaultConstructorExpectationSetup.java:105)
                  at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.withAnyArguments(DefaultConstructorExpectationSetup.java:71)
                  

                  我的项目中有以下 PowerMock 依赖项:

                  I have the following PowerMock dependencies in my project:

                  • org.powermock:powermock-module-junit4:1.5.6
                  • org.powermock:powermock-mockito-release-full:1.5.6

                  我已经跟踪了我的项目的依赖树并修复了冲突,以便 mockito-all:1.9.5 被包含在构建中.

                  I've traced the dependency tree of my project and fixed conflicts so that mockito-all:1.9.5 gets included in the build.

                  推荐答案

                  我的问题是由于我的项目(传递)依赖项中的 javassist 版本冲突.我所做的是搜索将旧版本的 javassist 放入构建中的所有依赖项,然后排除它们.例如:

                  My problem was due to conflicting versions of javassist in my project's (transitive) dependencies. What I did was search for all dependencies that put old version of javassist in the build, then exclude them. For example:

                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-entitymanager</artifactId>
                      <version>3.5.1-Final</version>
                      <scope>provided</scope>
                      <exclusions>
                          <exclusion>
                              <groupId>javassist</groupId>
                              <artifactId>javassist</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  

                  这篇关于PowerMock 抛出 NoSuchMethodError (setMockName)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                        <small id='kJzNi'></small><noframes id='kJzNi'>

                          <i id='kJzNi'><tr id='kJzNi'><dt id='kJzNi'><q id='kJzNi'><span id='kJzNi'><b id='kJzNi'><form id='kJzNi'><ins id='kJzNi'></ins><ul id='kJzNi'></ul><sub id='kJzNi'></sub></form><legend id='kJzNi'></legend><bdo id='kJzNi'><pre id='kJzNi'><center id='kJzNi'></center></pre></bdo></b><th id='kJzNi'></th></span></q></dt></tr></i><div id='kJzNi'><tfoot id='kJzNi'></tfoot><dl id='kJzNi'><fieldset id='kJzNi'></fieldset></dl></div>
                            <tbody id='kJzNi'></tbody>
                        • <tfoot id='kJzNi'></tfoot>
                          • <bdo id='kJzNi'></bdo><ul id='kJzNi'></ul>

                            <legend id='kJzNi'><style id='kJzNi'><dir id='kJzNi'><q id='kJzNi'></q></dir></style></legend>