GitHub user tzulitai opened a pull request: https://github.com/apache/flink/pull/5181
[FLINK-8283] [kafka] Fix mock verification on final method in FlinkKafkaConsumerBaseTest ## What is the purpose of the change Prior to this PR, `FlinkKafkaConsumerBaseTest::testSnapshotStateWithCommitOnCheckpointsEnabled()` was incorrectly mock verifying the `AbstractFetcher::commitInternalOffsetsToKafka()` method, which is final and cannot be mocked. This commit PR fixes this by making the method non-final. This seems to cause instabilities spanning several tests in the `FlinkKafkaConsumerBaseTest`. Note that ideally, that method should be final to prevent accidental overrides, but we actually have a lot of methods in the `AbstractFetcher` that should actually be best as final, but are not and mocked in the unit tests (e.g., `AbstractFetcher::snapshotState`, `AbstractFetcher::emitRecord`, etc). ## Brief change log - Make `AbstractFetcher::commitInternalOffsetsToKafka` non-final, so that it can be properly mocked in unit tests. ## Verifying this change This change is already covered by existing tests in `FlinkKafkaConsumerBaseTest`. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: no - The S3 file system connector: no ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? n/a You can merge this pull request into a Git repository by running: $ git pull https://github.com/tzulitai/flink FLINK-8283 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/5181.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #5181 ---- commit c8265cea34811c901bba2e9cd56e4870bf17622f Author: Tzu-Li (Gordon) Tai <tzuli...@apache.org> Date: 2017-12-19T10:00:37Z [FLINK-8283] [kafka] Fix mock verification on final method in FlinkKafkaConsumerBaseTest Prior to this commit, FlinkKafkaConsumerBaseTest::testSnapshotStateWithCommitOnCheckpointsEnabled() was incorrectly veryfing a final method on the AbstractFetcher class (specifically, the commitInternalOffsetsToKafka method). This commit fixes this by making the method non-final. Note that ideally, that method should be final to prevent accidental overrides, but we actually have a lot of methods in the AbstractFetcher that should actually be best as final, but are not and mocked in the unit tests. ---- ---