<tfoot id='lw3Go'></tfoot>

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

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

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

      1. Mockito.any() 通过泛型接口

        时间:2023-09-26

            • <legend id='orWgh'><style id='orWgh'><dir id='orWgh'><q id='orWgh'></q></dir></style></legend>

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

                <bdo id='orWgh'></bdo><ul id='orWgh'></ul>
                  <tbody id='orWgh'></tbody>
                  <tfoot id='orWgh'></tfoot>
                1. <i id='orWgh'><tr id='orWgh'><dt id='orWgh'><q id='orWgh'><span id='orWgh'><b id='orWgh'><form id='orWgh'><ins id='orWgh'></ins><ul id='orWgh'></ul><sub id='orWgh'></sub></form><legend id='orWgh'></legend><bdo id='orWgh'><pre id='orWgh'><center id='orWgh'></center></pre></bdo></b><th id='orWgh'></th></span></q></dt></tr></i><div id='orWgh'><tfoot id='orWgh'></tfoot><dl id='orWgh'><fieldset id='orWgh'></fieldset></dl></div>
                  本文介绍了Mockito.any() 通过泛型接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  是否可以使用泛型传递接口的类型?

                  is it possible to pass the type of an interface with generics?

                  界面:

                  public interface AsyncCallback<T>
                  

                  在我的测试方法中:

                  Mockito.any(AsyncCallback.class)
                  

                  <ResponseX> 放在 .class 后面或为 .class 不起作用.

                  Putting <ResponseX> behind or for .class didnt work.

                  推荐答案

                  有一种类型安全的方法:使用 ArgumentMatchers.any() 并用类型限定它:

                  There is a type-safe way: use ArgumentMatchers.any() and qualify it with the type:

                  ArgumentMatchers.<AsyncCallback<ResponseX>>any()
                  

                  这篇关于Mockito.any() 通过泛型接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何验证没有使用 Mockito 调用特定方法? 下一篇:PowerMock,模拟一个静态方法,然后在所有其他静

                  相关文章

                  最新文章

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

                  1. <legend id='egWEq'><style id='egWEq'><dir id='egWEq'><q id='egWEq'></q></dir></style></legend>

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