diff --git a/broker/src/test/java/org/apache/rocketmq/broker/processor/EndTransactionProcessorTest.java b/broker/src/test/java/org/apache/rocketmq/broker/processor/EndTransactionProcessorTest.java index 72b339ae73a..a364a1bbeeb 100644 --- a/broker/src/test/java/org/apache/rocketmq/broker/processor/EndTransactionProcessorTest.java +++ b/broker/src/test/java/org/apache/rocketmq/broker/processor/EndTransactionProcessorTest.java @@ -19,6 +19,7 @@ import io.netty.channel.ChannelHandlerContext; import org.apache.rocketmq.broker.BrokerController; import org.apache.rocketmq.broker.transaction.OperationResult; +import org.apache.rocketmq.broker.transaction.TransactionMetrics; import org.apache.rocketmq.broker.transaction.TransactionalMessageService; import org.apache.rocketmq.common.BrokerConfig; import org.apache.rocketmq.common.message.MessageAccessor; @@ -71,8 +72,12 @@ public class EndTransactionProcessorTest { @Mock private TransactionalMessageService transactionMsgService; + @Mock + private TransactionMetrics transactionMetrics; + @Before public void init() { + when(transactionMsgService.getTransactionMetrics()).thenReturn(transactionMetrics); brokerController.setMessageStore(messageStore); brokerController.setTransactionalMessageService(transactionMsgService); endTransactionProcessor = new EndTransactionProcessor(brokerController);