hgeraldino commented on code in PR #13383: URL: https://github.com/apache/kafka/pull/13383#discussion_r1175960401
########## connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerSourceTaskTest.java: ########## @@ -1003,31 +868,35 @@ private boolean awaitLatch(CountDownLatch latch) { return false; } - @SuppressWarnings("unchecked") private void expectOffsetFlush(boolean succeed) throws Exception { - EasyMock.expect(offsetWriter.beginFlush(EasyMock.anyLong(), EasyMock.anyObject())).andReturn(true); - Future<Void> flushFuture = PowerMock.createMock(Future.class); - EasyMock.expect(offsetWriter.doFlush(EasyMock.anyObject(Callback.class))).andReturn(flushFuture); + expectOffsetFlush(succeed, true); + } + + @SuppressWarnings("unchecked") + private void expectOffsetFlush(boolean succeed, boolean offsetFlush, Boolean... remainingVals) throws Exception { + when(offsetWriter.beginFlush(anyLong(), any(TimeUnit.class))).thenReturn(offsetFlush, remainingVals); + + if (offsetFlush) { Review Comment: This was definitely wrong. I re-implemented this logic splitting the `beginFlush` and `doFlush` calls into separate util methods. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org