4848import java .util .Map .Entry ;
4949import java .util .Properties ;
5050import java .util .Set ;
51+ import java .util .concurrent .ConcurrentHashMap ;
5152import java .util .concurrent .CountDownLatch ;
5253import java .util .concurrent .Executors ;
5354import java .util .concurrent .TimeUnit ;
@@ -2562,11 +2563,11 @@ public void testPauseResumeAndConsumerSeekAware() throws Exception {
25622563 given (consumer .assignment ()).willReturn (records .keySet ());
25632564 final CountDownLatch pauseLatch1 = new CountDownLatch (2 ); // consumer, event publisher
25642565 final CountDownLatch pauseLatch2 = new CountDownLatch (2 ); // consumer, consumer
2565- Set <TopicPartition > pausedParts = new HashSet <> ();
2566+ Set <TopicPartition > pausedParts = ConcurrentHashMap . newKeySet ();
25662567 willAnswer (i -> {
2568+ pausedParts .addAll (i .getArgument (0 ));
25672569 pauseLatch1 .countDown ();
25682570 pauseLatch2 .countDown ();
2569- pausedParts .addAll (i .getArgument (0 ));
25702571 return null ;
25712572 }).given (consumer ).pause (records .keySet ());
25722573 given (consumer .paused ()).willReturn (pausedParts );
@@ -2584,8 +2585,8 @@ public void testPauseResumeAndConsumerSeekAware() throws Exception {
25842585 });
25852586 final CountDownLatch resumeLatch = new CountDownLatch (2 );
25862587 willAnswer (i -> {
2587- resumeLatch .countDown ();
25882588 pausedParts .removeAll (i .getArgument (0 ));
2589+ resumeLatch .countDown ();
25892590 return null ;
25902591 }).given (consumer ).resume (any ());
25912592 willAnswer (invoc -> {
@@ -2701,7 +2702,7 @@ public void dontResumePausedPartition() throws Exception {
27012702 given (consumer .assignment ()).willReturn (Set .of (new TopicPartition ("foo" , 0 ), new TopicPartition ("foo" , 1 )));
27022703 final CountDownLatch pauseLatch1 = new CountDownLatch (1 );
27032704 final CountDownLatch pauseLatch2 = new CountDownLatch (2 );
2704- Set <TopicPartition > pausedParts = new HashSet <> ();
2705+ Set <TopicPartition > pausedParts = ConcurrentHashMap . newKeySet ();
27052706 willAnswer (i -> {
27062707 pausedParts .addAll (i .getArgument (0 ));
27072708 pauseLatch1 .countDown ();
@@ -2715,8 +2716,8 @@ public void dontResumePausedPartition() throws Exception {
27152716 });
27162717 final CountDownLatch resumeLatch = new CountDownLatch (1 );
27172718 willAnswer (i -> {
2718- resumeLatch .countDown ();
27192719 pausedParts .removeAll (i .getArgument (0 ));
2720+ resumeLatch .countDown ();
27202721 return null ;
27212722 }).given (consumer ).resume (any ());
27222723 ContainerProperties containerProps = new ContainerProperties (new TopicPartitionOffset ("foo" , 0 ),
0 commit comments