1. <small id='ZQhjZ'></small><noframes id='ZQhjZ'>

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

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

        <legend id='ZQhjZ'><style id='ZQhjZ'><dir id='ZQhjZ'><q id='ZQhjZ'></q></dir></style></legend>
      1. <tfoot id='ZQhjZ'></tfoot>
      2. Mockito:使用泛型参数进行验证

        时间:2023-09-26

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

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

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

                  <tfoot id='iE582'></tfoot>
                  本文介绍了Mockito:使用泛型参数进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  使用 Mockito,我可以做到以下几点:

                  With Mockito I can do the following:

                  verify(someService).process(any(Person.class));
                  

                  但是,如果 process 采用 Collection 代替,我该怎么写呢?无法弄清楚如何正确编写它.只是遇到语法错误...

                  But how do I write this if process takes a Collection<Person> instead? Can't figure out how to write it correctly. Just getting syntax errors...

                  推荐答案

                  试试:

                  verify(someService).process(Matchers.<Collection<Person>>any());
                  

                  实际上,当我键入 any() 时,IntelliJ 会自动建议此修复程序...不幸的是,在这种情况下您不能使用静态导入.

                  Actually, IntelliJ automatically suggested this fix when I typed any()... Unfortunately you cannot use static import in this case.

                  这篇关于Mockito:使用泛型参数进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Mockito's Matcher vs Hamcrest Matcher? 下一篇:模拟受保护的方法

                  相关文章

                  最新文章

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

                    1. <tfoot id='WMOWG'></tfoot>

                    2. <small id='WMOWG'></small><noframes id='WMOWG'>

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