Hi,

Hive heavily uses PowerMock <https://powermock.github.io/>. The main
purpose of it is having static mocking.

The sad thing is it seems PowerMock is dead:
- The main branch got it's lot commit in 2022 and and most of the
contributions last year were simple dependency upgrades:
https://github.com/powermock/powermock/commits/release/2.x
- The last release was in 2020
- And their mailing list looks dead as well. That is the last email on that
list: https://groups.google.com/g/powermock/c/JdYY3naZlbU. It asked if it
was discontinued and didn't get an answer at all.

So officially, it is not dead but it seems it is.

Back then when PowerMock development started, there were no static mocking
in mockito. But since then, it is possible using mockito-inline.

I won't lie, it is hard to switch from PowerMock: it enables some coding
patterns that are considered bad patterns and it leads to code that is
harder to test. Last year I played with it and removed it from the
hive-exec module: https://github.com/apache/hive/pull/3798.

The hard part in removing it is that PowerMock and mockito-inline don't
work together. So when we want to remove it, we have to do it in one pull
request for a given module. It cannot be separated into smaller steps.
The good news is as it relates to testing, pre commit tests can validate
the refactor.

What do you think? Should we move away from PowerMock or keep it as it is?

Thank you,
Zsolt Miskolczi

Reply via email to