kafka
kafka copied to clipboard
KAFKA-14058: Migrate ExactlyOnceWorkerSourceTaskTest from EasyMock and PowerMock to Mockito
Some notes:
- Introduced new
ConcurrencyUtils
andMockitoUtils
classes for reusable testing logic that will likely be used in the near future for KAFKA-14059 and KAFKA-14060. - Refactored a lot of common logic into dedicated methods, which reduces test size and should make tests easier to write.
- Doubled the default record batch size from 1 to 2. This provides better coverage and, after all the refactoring from step 2, required no modifications to mocking, verification, or assertion logic anywhere in the test suite.
- Stopped inheriting from the
ThreadedTest
class as it does nothing (filed https://github.com/apache/kafka/pull/12410 to apply this change across the board). - Once this looks good enough to merge, I'll begin applying the same changes to the
WorkerSourceTaskTest
and possiblyAbstractWorkerSourceTaskTest
test suites.
Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
@clolov since you've been working on the JUnit migration for Streams, would you be interested in reviewing this?
Oh, apologies, I didn't get a notification for this. Yep, I will review it shortly.
I find this refactor quite readable. Looks good to me :)
Rebased on latest trunk, test failures appear unrelated.
@showuon @mimaison would one of you be able to take a look at this?
Thanks @mimaison. Test failures appear unrelated, going to merge.