You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/30 07:12:23 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue, #19708: Prevent MockitoJunitRunner.Silent from unit tests

TeslaCN opened a new issue, #19708:
URL: https://github.com/apache/shardingsphere/issues/19708

   ## Code of Conduct
   
   According to Mockito's code, Silent is not recommended to use in tests.
   
   ```java
       /**
        * This Mockito JUnit Runner implementation *ignores*
        * stubbing argument mismatches ({@link MockitoJUnitRunner.StrictStubs})
        * and *does not detect* unused stubbings.
        * The runner remains 'silent' even if incorrect stubbing is present.
        * It is an equivalent of {@link Strictness#LENIENT}.
        * This was the behavior of Mockito JUnit runner in versions 1.x.
        * Using this implementation of the runner is not recommended.
        * Engineers should care for removing unused stubbings because they are dead code,
        * they add unnecessary details, potentially making the test code harder to comprehend.
        * If you have good reasons to use the silent runner, let us know at the mailing list
        * or raise an issue in our issue tracker.
        * The purpose of silent implementation is to satisfy edge/unanticipated use cases,
        * and to offer users an opt-out.
        * Mockito framework is opinionated to drive clean tests but it is not dogmatic.
        * <p>
        * See also {@link UnnecessaryStubbingException}.
        * <p>
        * Usage:
        * <pre class="code"><code class="java">
        * <b>&#064;RunWith(MockitoJUnitRunner.Silent.class)</b>
        * public class ExampleTest {
        *   // ...
        * }
        * </code></pre>
        *
        * @since 2.1.0
        */
       public static class Silent extends MockitoJUnitRunner {
           public Silent(Class<?> klass) throws InvocationTargetException {
               super(new RunnerFactory().create(klass));
           }
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu closed issue #19708: Prevent MockitoJunitRunner.Silent from unit tests

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #19708: Prevent MockitoJunitRunner.Silent from unit tests
URL: https://github.com/apache/shardingsphere/issues/19708


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org