dajac commented on code in PR #14985: URL: https://github.com/apache/kafka/pull/14985#discussion_r1432340012
########## core/src/test/scala/unit/kafka/coordinator/group/CoordinatorLoaderImplTest.scala: ########## @@ -511,4 +544,35 @@ class CoordinatorLoaderImplTest { new FetchDataInfo(new LogOffsetMetadata(startOffset), fileRecords) } + + private def logReadResult( + startOffset: Long, + producerId: Long, + producerEpoch: Short, + controlRecordType: ControlRecordType + ): FetchDataInfo = { + val fileRecords = mock(classOf[FileRecords]) + val memoryRecords = MemoryRecords.withEndTransactionMarker( + startOffset, + 0L, + RecordBatch.NO_PARTITION_LEADER_EPOCH, + producerId, + producerEpoch, + new EndTransactionMarker(controlRecordType, 0) + ) + + when(fileRecords.sizeInBytes).thenReturn(memoryRecords.sizeInBytes) + + val bufferCapture: ArgumentCaptor[ByteBuffer] = ArgumentCaptor.forClass(classOf[ByteBuffer]) + when(fileRecords.readInto( + bufferCapture.capture(), + ArgumentMatchers.anyInt()) + ).thenAnswer { _ => + val buffer = bufferCapture.getValue + buffer.put(memoryRecords.buffer.duplicate) + buffer.flip() + } + + new FetchDataInfo(new LogOffsetMetadata(startOffset), fileRecords) Review Comment: When you read from the log, you get back FileRecords. -- 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