KAFKA-12950: Replace EasyMock and PowerMock with Mockito for KafkaStreamsTest
This PR build on top of https://github.com/apache/kafka/pull/11017. I have added the previous author's comment in this PR for attribution. I have also addressed the pending comments from @chia7712 in this PR.
Notes to help the reviewer:
- Mockito has
mockStaticmethod which is equivalent to PowerMock's method. - When we run the tests using
@RunWith(MockitoJUnitRunner.StrictStubs.class)Mockito performs a verify() for all stubs that are mentioned, hence, there is no need to explicitly verify the stubs (unless you want to verify the number of times etc.). Note that this does not work for static mocks.
Testing
Validated that test is run successfully as part of ./gradlew streams:unitTest
Code coverage
Before

After

@ijuma Please review when you get a chance. This would help us take a step forward in getting rid of easymock/powermock dependency.
@cadonna requesting your review on this PR related to streams.
@cadonna please review when you get a chance. You can also refer to previous PR https://github.com/apache/kafka/pull/12465 and note that the comments provided there have been addressed.
@cadonna this is ready for your review whenever you get a chance.
Rebased from latest commits in trunk
Failures unrelated
Merged #12465 into trunk
Thanks for the contribution @divijvaidya !
@divijvaidya So can we close #11017 after this is merged?
@dengziming yes please. It can be closed.