You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Gabor Somogyi (Jira)" <ji...@apache.org> on 2022/05/13 10:57:00 UTC

[jira] [Created] (FLINK-27605) Upgrade mockito to a version where static function mocking is possible

Gabor Somogyi created FLINK-27605:
-------------------------------------

             Summary: Upgrade mockito to a version where static function mocking is possible
                 Key: FLINK-27605
                 URL: https://issues.apache.org/jira/browse/FLINK-27605
             Project: Flink
          Issue Type: Sub-task
          Components: Tests
    Affects Versions: 1.16.0
            Reporter: Gabor Somogyi


There are some external APIs used by Flink which are designed in a way which is super hard to test.
Such a pattern is when a class instance is only available through a static function and no publicly available constructor exists.
A good example to this is "UserGroupInformation" class in Hadoop library.

We've listed many different possibilities how to make it testable in the following place: https://github.com/apache/flink/pull/19372#discussion_r849691193
After deep consideration we've agreed to use static function mocking in such exceptional cases in order to make code clean and maintainable.

It should be emphasized that the general direction not changed in terms of Mockito and Powermock usage. It should be avoided as much as possible.




--
This message was sent by Atlassian Jira
(v8.20.7#820007)