• <tfoot id='v39Se'></tfoot>

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

        <legend id='v39Se'><style id='v39Se'><dir id='v39Se'><q id='v39Se'></q></dir></style></legend>
        • <bdo id='v39Se'></bdo><ul id='v39Se'></ul>

        Mockito:使用泛型列出匹配器

        时间:2023-09-25
        • <bdo id='F0Mio'></bdo><ul id='F0Mio'></ul>
        • <legend id='F0Mio'><style id='F0Mio'><dir id='F0Mio'><q id='F0Mio'></q></dir></style></legend>
        • <small id='F0Mio'></small><noframes id='F0Mio'>

              <tbody id='F0Mio'></tbody>

                  <tfoot id='F0Mio'></tfoot>

                  <i id='F0Mio'><tr id='F0Mio'><dt id='F0Mio'><q id='F0Mio'><span id='F0Mio'><b id='F0Mio'><form id='F0Mio'><ins id='F0Mio'></ins><ul id='F0Mio'></ul><sub id='F0Mio'></sub></form><legend id='F0Mio'></legend><bdo id='F0Mio'><pre id='F0Mio'><center id='F0Mio'></center></pre></bdo></b><th id='F0Mio'></th></span></q></dt></tr></i><div id='F0Mio'><tfoot id='F0Mio'></tfoot><dl id='F0Mio'><fieldset id='F0Mio'></fieldset></dl></div>
                  本文介绍了Mockito:使用泛型列出匹配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  Mockito 提供:

                  Mockito offers:

                  when(mock.process(Matchers.any(List.class)));
                  

                  如果 process 采用 List<Bar> 代替,如何避免警告?

                  How to avoid warning if process takes a List<Bar> instead?

                  推荐答案

                  对于Java 8 及以上,很简单:

                  For Java 8 and above, it's easy:

                  when(mock.process(Matchers.anyList()));
                  

                  对于 Java 7 及以下版本,编译器需要一些帮助.使用 anyListOf(Class clazz):

                  For Java 7 and below, the compiler needs a bit of help. Use anyListOf(Class<T> clazz):

                  when(mock.process(Matchers.anyListOf(Bar.class)));
                  

                  这篇关于Mockito:使用泛型列出匹配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:当我运行 mockito 测试时发生 WrongTypeOfReturnValue 异 下一篇:如何使用 mockito 测试 REST 服务?

                  相关文章

                  最新文章

                  • <bdo id='cXfYA'></bdo><ul id='cXfYA'></ul>

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

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

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