MINOR: fix bug in MockConsumer (#19627)

The setter of `maxPollRecords` wrongly checks the field instead of the argument.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, TengYao Chi
 <frankvicky@apache.org>
This commit is contained in:
Matthias J. Sax 2025-05-02 23:08:18 -07:00 committed by GitHub
parent 28ad4dd5c5
commit 44025d8116
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -335,7 +335,7 @@ public class MockConsumer<K, V> implements Consumer<K, V> {
* @param maxPollRecords the max.poll.records. * @param maxPollRecords the max.poll.records.
*/ */
public synchronized void setMaxPollRecords(long maxPollRecords) { public synchronized void setMaxPollRecords(long maxPollRecords) {
if (this.maxPollRecords < 1) { if (maxPollRecords < 1) {
throw new IllegalArgumentException("MaxPollRecords must be strictly superior to 0"); throw new IllegalArgumentException("MaxPollRecords must be strictly superior to 0");
} }
this.maxPollRecords = maxPollRecords; this.maxPollRecords = maxPollRecords;