Skip to content

[Improvement][Test] Remove dependency of powermock #11405

@EricGao888

Description

@EricGao888

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

Sub-Tasks

I have split the task into six sub-tasks by workload:

Examples

Currently we have several typical scenarios where we heavily rely on Powermock

  1. Mock static class
  2. Suppress Static Initialization Error
  3. Access private method in UT
    ... (to be continued)

I will give some examples and corresponding solutions for these scenarios respectively as follows:

  1. Add mockito-inline and use Mockito.mockStatic as an alternative.
  2. Simply mocking some special static classes with Mockito.mockStatic will cause Static Initialization Error. For these special cases, we need to refactor the origin class with some tricks to decouple the usage of static method.
  3. Change private method to protected

For examples, see: #11588

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions