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

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

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

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

        不推荐使用 MockitoJUnitRunner

        时间:2023-10-01
          <tfoot id='aZhps'></tfoot>

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

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

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

                  问题描述

                  我正在尝试使用 @InjectMocks@Mock 进行单元测试.

                  I'm trying to make a unit test with @InjectMocks and @Mock.

                  @RunWith(MockitoJUnitRunner.class)
                  public class ProblemDefinitionTest {
                  
                      @InjectMocks
                      ProblemDefinition problemDefinition;
                  
                      @Mock
                      Matrix matrixMock;    
                  
                      @Test
                      public void sanityCheck() {
                          Assert.assertNotNull(problemDefinition);
                          Assert.assertNotNull(matrixMock);
                      }
                  }
                  

                  当我不包含 @RunWith 注释时,测试会失败.但是

                  When I don't include the @RunWith annotation, the test fails. But

                  类型 MockitoJUnitRunner 已弃用

                  The type MockitoJUnitRunner is deprecated

                  我使用的是 Mockito 2.6.9.我该怎么办?

                  I'm using Mockito 2.6.9. How should I go about this?

                  推荐答案

                  org.mockito.runners.MockitoJUnitRunner 现在确实被弃用了,你应该使用 org.mockito.junit.MockitoJUnitRunner.如您所见,只有包名发生了变化,类的简单名称仍然是 MockitoJUnitRunner.

                  摘自org.mockito.runners.MockitoJUnitRunner的javadoc:

                  Excerpt from the javadoc of org.mockito.runners.MockitoJUnitRunner:

                  移至 MockitoJUnitRunner,这个类将被删除Mockito 3

                  Moved to MockitoJUnitRunner, this class will be removed with Mockito 3

                  这篇关于不推荐使用 MockitoJUnitRunner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Maven:在不同的源代码级别上编译和测试 下一篇:如何使用 mockito 模拟字符串?

                  相关文章

                  最新文章

                    <tfoot id='8M5Hy'></tfoot>

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

                        <bdo id='8M5Hy'></bdo><ul id='8M5Hy'></ul>
                      <legend id='8M5Hy'><style id='8M5Hy'><dir id='8M5Hy'><q id='8M5Hy'></q></dir></style></legend>