@ -58,6 +58,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -58,6 +58,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner ;
import org.powermock.reflect.Whitebox ;
import java.time.Duration ;
import java.util.ArrayList ;
import java.util.Collection ;
import java.util.Collections ;
@ -458,7 +459,7 @@ public class WorkerSinkTaskTest {
@@ -458,7 +459,7 @@ public class WorkerSinkTaskTest {
sinkTask . open ( partitions ) ;
EasyMock . expectLastCall ( ) ;
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andAnswer (
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andAnswer (
new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
@Override
public ConsumerRecords < byte [ ] , byte [ ] > answer ( ) throws Throwable {
@ -893,7 +894,7 @@ public class WorkerSinkTaskTest {
@@ -893,7 +894,7 @@ public class WorkerSinkTaskTest {
// Expect the next poll to discover and perform the rebalance, THEN complete the previous callback handler,
// and then return one record for TP1 and one for TP3.
final AtomicBoolean rebalanced = new AtomicBoolean ( ) ;
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andAnswer (
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andAnswer (
new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
@Override
public ConsumerRecords < byte [ ] , byte [ ] > answer ( ) throws Throwable {
@ -1273,7 +1274,7 @@ public class WorkerSinkTaskTest {
@@ -1273,7 +1274,7 @@ public class WorkerSinkTaskTest {
sinkTask . preCommit ( EasyMock . < Map < TopicPartition , OffsetAndMetadata > > anyObject ( ) ) ;
EasyMock . expectLastCall ( ) . andReturn ( Collections . emptyMap ( ) ) ;
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andAnswer (
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andAnswer (
new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
@Override
public ConsumerRecords < byte [ ] , byte [ ] > answer ( ) throws Throwable {
@ -1298,7 +1299,7 @@ public class WorkerSinkTaskTest {
@@ -1298,7 +1299,7 @@ public class WorkerSinkTaskTest {
sinkTask . open ( partitions ) ;
EasyMock . expectLastCall ( ) . andThrow ( e ) ;
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andAnswer (
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andAnswer (
new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
@Override
public ConsumerRecords < byte [ ] , byte [ ] > answer ( ) throws Throwable {
@ -1315,7 +1316,7 @@ public class WorkerSinkTaskTest {
@@ -1315,7 +1316,7 @@ public class WorkerSinkTaskTest {
sinkTask . open ( partitions ) ;
EasyMock . expectLastCall ( ) ;
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andAnswer ( new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andAnswer ( new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
@Override
public ConsumerRecords < byte [ ] , byte [ ] > answer ( ) throws Throwable {
rebalanceListener . getValue ( ) . onPartitionsAssigned ( partitions ) ;
@ -1332,7 +1333,7 @@ public class WorkerSinkTaskTest {
@@ -1332,7 +1333,7 @@ public class WorkerSinkTaskTest {
private void expectConsumerWakeup ( ) {
consumer . wakeup ( ) ;
EasyMock . expectLastCall ( ) ;
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andThrow ( new WakeupException ( ) ) ;
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andThrow ( new WakeupException ( ) ) ;
}
private void expectConsumerPoll ( final int numMessages ) {
@ -1340,7 +1341,7 @@ public class WorkerSinkTaskTest {
@@ -1340,7 +1341,7 @@ public class WorkerSinkTaskTest {
}
private void expectConsumerPoll ( final int numMessages , final long timestamp , final TimestampType timestampType ) {
EasyMock . expect ( consumer . poll ( EasyMock . anyLong ( ) ) ) . andAnswer (
EasyMock . expect ( consumer . poll ( Duration . ofMillis ( EasyMock . anyLong ( ) ) ) ) . andAnswer (
new IAnswer < ConsumerRecords < byte [ ] , byte [ ] > > ( ) {
@Override
public ConsumerRecords < byte [ ] , byte [ ] > answer ( ) throws Throwable {