@@ -499,7 +499,7 @@ public void testRecordAck() throws Exception {
499
499
public void testRecordAckMock () throws Exception {
500
500
ConsumerFactory <Integer , String > cf = mock (ConsumerFactory .class );
501
501
Consumer <Integer , String > consumer = mock (Consumer .class );
502
- given (cf .createConsumer (isNull ( ), eq ("clientId" ), isNull ())).willReturn (consumer );
502
+ given (cf .createConsumer (eq ( "grp" ), eq ("clientId" ), isNull ())).willReturn (consumer );
503
503
final Map <TopicPartition , List <ConsumerRecord <Integer , String >>> records = new HashMap <>();
504
504
records .put (new TopicPartition ("foo" , 0 ), Arrays .asList (
505
505
new ConsumerRecord <>("foo" , 0 , 0L , 1 , "foo" ),
@@ -512,6 +512,7 @@ public void testRecordAckMock() throws Exception {
512
512
TopicPartitionInitialOffset [] topicPartition = new TopicPartitionInitialOffset [] {
513
513
new TopicPartitionInitialOffset ("foo" , 0 ) };
514
514
ContainerProperties containerProps = new ContainerProperties (topicPartition );
515
+ containerProps .setGroupId ("grp" );
515
516
containerProps .setAckMode (AckMode .RECORD );
516
517
final CountDownLatch latch = new CountDownLatch (2 );
517
518
MessageListener <Integer , String > messageListener = spy (
@@ -565,7 +566,7 @@ public void testRecordAckMockForeignThreadImmediate() throws Exception {
565
566
private void testRecordAckMockForeignThreadGuts (AckMode ackMode ) throws Exception {
566
567
ConsumerFactory <Integer , String > cf = mock (ConsumerFactory .class );
567
568
Consumer <Integer , String > consumer = mock (Consumer .class );
568
- given (cf .createConsumer (isNull ( ), eq ("clientId" ), isNull ())).willReturn (consumer );
569
+ given (cf .createConsumer (eq ( "grp" ), eq ("clientId" ), isNull ())).willReturn (consumer );
569
570
final Map <TopicPartition , List <ConsumerRecord <Integer , String >>> records = new HashMap <>();
570
571
records .put (new TopicPartition ("foo" , 0 ), Arrays .asList (
571
572
new ConsumerRecord <>("foo" , 0 , 0L , 1 , "foo" ),
@@ -578,6 +579,7 @@ private void testRecordAckMockForeignThreadGuts(AckMode ackMode) throws Exceptio
578
579
TopicPartitionInitialOffset [] topicPartition = new TopicPartitionInitialOffset [] {
579
580
new TopicPartitionInitialOffset ("foo" , 0 ) };
580
581
ContainerProperties containerProps = new ContainerProperties (topicPartition );
582
+ containerProps .setGroupId ("grp" );
581
583
containerProps .setAckMode (ackMode );
582
584
final CountDownLatch latch = new CountDownLatch (2 );
583
585
final List <Acknowledgment > acks = new ArrayList <>();
@@ -627,7 +629,7 @@ public void onMessage(ConsumerRecord<Integer, String> data, Acknowledgment ackno
627
629
public void testNonResponsiveConsumerEvent () throws Exception {
628
630
ConsumerFactory <Integer , String > cf = mock (ConsumerFactory .class );
629
631
Consumer <Integer , String > consumer = mock (Consumer .class );
630
- given (cf .createConsumer (isNull ( ), eq ("" ), isNull ())).willReturn (consumer );
632
+ given (cf .createConsumer (eq ( "grp" ), eq ("" ), isNull ())).willReturn (consumer );
631
633
final Map <TopicPartition , List <ConsumerRecord <Integer , String >>> records = new HashMap <>();
632
634
records .put (new TopicPartition ("foo" , 0 ), Arrays .asList (
633
635
new ConsumerRecord <>("foo" , 0 , 0L , 1 , "foo" ),
@@ -644,6 +646,7 @@ public void testNonResponsiveConsumerEvent() throws Exception {
644
646
TopicPartitionInitialOffset [] topicPartition = new TopicPartitionInitialOffset [] {
645
647
new TopicPartitionInitialOffset ("foo" , 0 ) };
646
648
ContainerProperties containerProps = new ContainerProperties (topicPartition );
649
+ containerProps .setGroupId ("grp" );
647
650
containerProps .setNoPollThreshold (2.0f );
648
651
containerProps .setPollTimeout (10 );
649
652
containerProps .setMonitorInterval (1 );
@@ -1703,7 +1706,7 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
1703
1706
public void testPauseResume () throws Exception {
1704
1707
ConsumerFactory <Integer , String > cf = mock (ConsumerFactory .class );
1705
1708
Consumer <Integer , String > consumer = mock (Consumer .class );
1706
- given (cf .createConsumer (isNull ( ), eq ("clientId" ), isNull ())).willReturn (consumer );
1709
+ given (cf .createConsumer (eq ( "grp" ), eq ("clientId" ), isNull ())).willReturn (consumer );
1707
1710
final Map <TopicPartition , List <ConsumerRecord <Integer , String >>> records = new HashMap <>();
1708
1711
records .put (new TopicPartition ("foo" , 0 ), Arrays .asList (
1709
1712
new ConsumerRecord <>("foo" , 0 , 0L , 1 , "foo" ),
@@ -1735,6 +1738,7 @@ public void testPauseResume() throws Exception {
1735
1738
TopicPartitionInitialOffset [] topicPartition = new TopicPartitionInitialOffset [] {
1736
1739
new TopicPartitionInitialOffset ("foo" , 0 ) };
1737
1740
ContainerProperties containerProps = new ContainerProperties (topicPartition );
1741
+ containerProps .setGroupId ("grp" );
1738
1742
containerProps .setAckMode (AckMode .RECORD );
1739
1743
containerProps .setClientId ("clientId" );
1740
1744
containerProps .setIdleEventInterval (100L );
@@ -1764,7 +1768,7 @@ else if (e instanceof ConsumerResumedEvent) {
1764
1768
public void testInitialSeek () throws Exception {
1765
1769
ConsumerFactory <Integer , String > cf = mock (ConsumerFactory .class );
1766
1770
Consumer <Integer , String > consumer = mock (Consumer .class );
1767
- given (cf .createConsumer (isNull ( ), eq ("clientId" ), isNull ())).willReturn (consumer );
1771
+ given (cf .createConsumer (eq ( "grp" ), eq ("clientId" ), isNull ())).willReturn (consumer );
1768
1772
ConsumerRecords <Integer , String > emptyRecords = new ConsumerRecords <>(Collections .emptyMap ());
1769
1773
final CountDownLatch latch = new CountDownLatch (1 );
1770
1774
given (consumer .poll (anyLong ())).willAnswer (i -> {
@@ -1781,6 +1785,7 @@ public void testInitialSeek() throws Exception {
1781
1785
new TopicPartitionInitialOffset ("foo" , 5 , SeekPosition .END ),
1782
1786
};
1783
1787
ContainerProperties containerProps = new ContainerProperties (topicPartition );
1788
+ containerProps .setGroupId ("grp" );
1784
1789
containerProps .setAckMode (AckMode .RECORD );
1785
1790
containerProps .setClientId ("clientId" );
1786
1791
containerProps .setMessageListener ((MessageListener ) r -> { });
@@ -1868,7 +1873,7 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
1868
1873
public void testAckModeCount () throws Exception {
1869
1874
ConsumerFactory <Integer , String > cf = mock (ConsumerFactory .class );
1870
1875
Consumer <Integer , String > consumer = mock (Consumer .class );
1871
- given (cf .createConsumer (isNull ( ), eq ("clientId" ), isNull ())).willReturn (consumer );
1876
+ given (cf .createConsumer (eq ( "grp" ), eq ("clientId" ), isNull ())).willReturn (consumer );
1872
1877
TopicPartition topicPartition = new TopicPartition ("foo" , 0 );
1873
1878
final Map <TopicPartition , List <ConsumerRecord <Integer , String >>> records1 = new HashMap <>();
1874
1879
records1 .put (topicPartition , Arrays .asList (
@@ -1911,6 +1916,7 @@ public void testAckModeCount() throws Exception {
1911
1916
TopicPartitionInitialOffset [] topicPartitionOffset = new TopicPartitionInitialOffset [] {
1912
1917
new TopicPartitionInitialOffset ("foo" , 0 ) };
1913
1918
ContainerProperties containerProps = new ContainerProperties (topicPartitionOffset );
1919
+ containerProps .setGroupId ("grp" );
1914
1920
containerProps .setAckMode (AckMode .COUNT );
1915
1921
containerProps .setAckCount (3 );
1916
1922
containerProps .setClientId ("clientId" );
0 commit comments