@ -1494,6 +1494,7 @@ public class KafkaAdminClientTest {
TopicPartition myTopicPartition0 = new TopicPartition ( "my_topic" , 0 ) ;
TopicPartition myTopicPartition0 = new TopicPartition ( "my_topic" , 0 ) ;
TopicPartition myTopicPartition1 = new TopicPartition ( "my_topic" , 1 ) ;
TopicPartition myTopicPartition1 = new TopicPartition ( "my_topic" , 1 ) ;
TopicPartition myTopicPartition2 = new TopicPartition ( "my_topic" , 2 ) ;
TopicPartition myTopicPartition2 = new TopicPartition ( "my_topic" , 2 ) ;
TopicPartition myTopicPartition3 = new TopicPartition ( "my_topic" , 3 ) ;
final Map < TopicPartition , OffsetFetchResponse . PartitionData > responseData = new HashMap < > ( ) ;
final Map < TopicPartition , OffsetFetchResponse . PartitionData > responseData = new HashMap < > ( ) ;
responseData . put ( myTopicPartition0 , new OffsetFetchResponse . PartitionData ( 10 ,
responseData . put ( myTopicPartition0 , new OffsetFetchResponse . PartitionData ( 10 ,
@ -1502,15 +1503,19 @@ public class KafkaAdminClientTest {
Optional . empty ( ) , "" , Errors . NONE ) ) ;
Optional . empty ( ) , "" , Errors . NONE ) ) ;
responseData . put ( myTopicPartition2 , new OffsetFetchResponse . PartitionData ( 20 ,
responseData . put ( myTopicPartition2 , new OffsetFetchResponse . PartitionData ( 20 ,
Optional . empty ( ) , "" , Errors . NONE ) ) ;
Optional . empty ( ) , "" , Errors . NONE ) ) ;
responseData . put ( myTopicPartition3 , new OffsetFetchResponse . PartitionData ( OffsetFetchResponse . INVALID_OFFSET ,
Optional . empty ( ) , "" , Errors . NONE ) ) ;
env . kafkaClient ( ) . prepareResponse ( new OffsetFetchResponse ( Errors . NONE , responseData ) ) ;
env . kafkaClient ( ) . prepareResponse ( new OffsetFetchResponse ( Errors . NONE , responseData ) ) ;
final ListConsumerGroupOffsetsResult result = env . adminClient ( ) . listConsumerGroupOffsets ( "group-0" ) ;
final ListConsumerGroupOffsetsResult result = env . adminClient ( ) . listConsumerGroupOffsets ( "group-0" ) ;
final Map < TopicPartition , OffsetAndMetadata > partitionToOffsetAndMetadata = result . partitionsToOffsetAndMetadata ( ) . get ( ) ;
final Map < TopicPartition , OffsetAndMetadata > partitionToOffsetAndMetadata = result . partitionsToOffsetAndMetadata ( ) . get ( ) ;
assertEquals ( 3 , partitionToOffsetAndMetadata . size ( ) ) ;
assertEquals ( 4 , partitionToOffsetAndMetadata . size ( ) ) ;
assertEquals ( 10 , partitionToOffsetAndMetadata . get ( myTopicPartition0 ) . offset ( ) ) ;
assertEquals ( 10 , partitionToOffsetAndMetadata . get ( myTopicPartition0 ) . offset ( ) ) ;
assertEquals ( 0 , partitionToOffsetAndMetadata . get ( myTopicPartition1 ) . offset ( ) ) ;
assertEquals ( 0 , partitionToOffsetAndMetadata . get ( myTopicPartition1 ) . offset ( ) ) ;
assertEquals ( 20 , partitionToOffsetAndMetadata . get ( myTopicPartition2 ) . offset ( ) ) ;
assertEquals ( 20 , partitionToOffsetAndMetadata . get ( myTopicPartition2 ) . offset ( ) ) ;
assertTrue ( partitionToOffsetAndMetadata . containsKey ( myTopicPartition3 ) ) ;
assertNull ( partitionToOffsetAndMetadata . get ( myTopicPartition3 ) ) ;
}
}
}
}