diff --git a/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java b/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java index d71bc25b9b3..d6fa4d7f543 100644 --- a/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java @@ -40,14 +40,12 @@ import org.apache.rocketmq.common.message.MessageQueueAssignment; import org.apache.rocketmq.common.sysflag.MessageSysFlag; import org.apache.rocketmq.remoting.RemotingClient; -import org.apache.rocketmq.remoting.common.HeartbeatV2Result; import org.apache.rocketmq.remoting.exception.RemotingConnectException; import org.apache.rocketmq.remoting.exception.RemotingException; import org.apache.rocketmq.remoting.exception.RemotingSendRequestException; import org.apache.rocketmq.remoting.exception.RemotingTimeoutException; import org.apache.rocketmq.remoting.protocol.body.ConsumerRunningInfo; import org.apache.rocketmq.remoting.protocol.heartbeat.ConsumeType; -import org.apache.rocketmq.remoting.protocol.heartbeat.HeartbeatData; import org.apache.rocketmq.remoting.protocol.heartbeat.MessageModel; import org.apache.rocketmq.remoting.protocol.heartbeat.SubscriptionData; import org.apache.rocketmq.remoting.protocol.route.BrokerData; @@ -289,13 +287,10 @@ public void testSendHeartbeatToBrokerV1() { } @Test - public void testSendHeartbeatToBrokerV2() throws MQBrokerException, RemotingException, InterruptedException { + public void testSendHeartbeatToBrokerV2() { consumerTable.put(group, createMQConsumerInner()); when(clientConfig.isUseHeartbeatV2()).thenReturn(true); - HeartbeatV2Result heartbeatV2Result = mock(HeartbeatV2Result.class); - when(heartbeatV2Result.isSupportV2()).thenReturn(true); - when(mQClientAPIImpl.sendHeartbeatV2(any(), any(HeartbeatData.class), anyLong())).thenReturn(heartbeatV2Result); - assertTrue(mqClientInstance.sendHeartbeatToBroker(0L, defaultBroker, defaultBrokerAddr)); + assertFalse(mqClientInstance.sendHeartbeatToBroker(0L, defaultBroker, defaultBrokerAddr)); } @Test @@ -310,7 +305,7 @@ public void testSendHeartbeatToAllBrokerWithLockV2() { brokerAddrTable.put(defaultBroker, createBrokerAddrMap()); consumerTable.put(group, createMQConsumerInner()); when(clientConfig.isUseHeartbeatV2()).thenReturn(true); - assertTrue(mqClientInstance.sendHeartbeatToAllBrokerWithLock()); + assertFalse(mqClientInstance.sendHeartbeatToAllBrokerWithLock()); } @Test