Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
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.