### Question:
ConsumerServiceImpl extends AbstractBaseService<ConsumerEntity> implements ConsumerService { @Override public FailMsgPublishAndUpdateResultResponse publishAndUpdateResultFailMsg( FailMsgPublishAndUpdateResultRequest request) { FailMsgPublishAndUpdateResultResponse response = new FailMsgPublishAndUpdateResultResponse(); response.setSuc(true); QueueEntity queue = queueService.getAllQueueMap().get(request.getQueueId()); if (request.getFailMsg() != null) { PublishMessageResponse publishMessageResponse = publish(request.getFailMsg()); response.setSuc(publishMessageResponse.isSuc()); if (request.getFailMsg().getMsgs() != null) { request.getFailMsg().getMsgs().forEach(t1 -> { deleteOldFailMsg(request.getFailMsg(), t1, queue); }); } } if (!CollectionUtils.isEmpty(request.getIds())) { if (queue != null && queue.getNodeType() == 2 && !CollectionUtils.isEmpty(request.getIds())) { message01Service.setDbId(queue.getDbNodeId()); message01Service.updateFailMsgResult(queue.getTbName(), request.getIds(), Message01Service.failMsgRetryCountSuc); } } return response; }  @Override @Transactional(rollbackFor = Exception.class) ConsumerRegisterResponse register(ConsumerRegisterRequest request); @Override @Transactional(rollbackFor = Exception.class) ConsumerDeRegisterResponse deRegister(ConsumerDeRegisterRequest deRegisterRequest); @Override void heartbeat(List<Long> ids); @Override List<ConsumerGroupConsumerEntity> getConsumerGroupByConsumerIds(List<Long> consumerIds); @Override List<ConsumerGroupConsumerEntity> getConsumerGroupByConsumerGroupIds(List<Long> consumerGroupIds); @Override //@Transactional(rollbackFor = Exception.class) ConsumerGroupRegisterResponse registerConsumerGroup(ConsumerGroupRegisterRequest request); @Override PublishMessageResponse publish(PublishMessageRequest request); void notifyClient(QueueEntity queueEntity); @Override PullDataResponse pullData(PullDataRequest request); @Override GetMessageCountResponse getMessageCount(GetMessageCountRequest request); @Override List<ConsumerEntity> findByHeartTimeInterval(long heartTimeInterval); @Override boolean deleteByConsumers(List<ConsumerEntity> consumers); @Override ConsumerEntity getConsumerByConsumerGroupId(Long consumerGroupId); @Override long countBy(Map<String, Object> conditionMap); @Override List<ConsumerEntity> getListBy(Map<String, Object> conditionMap); @Override FailMsgPublishAndUpdateResultResponse publishAndUpdateResultFailMsg(
            FailMsgPublishAndUpdateResultRequest request);  }### Answer:
@Test public void publishAndUpdateResultFailMsgTest() { FailMsgPublishAndUpdateResultRequest request = new FailMsgPublishAndUpdateResultRequest(); request.setQueueId(1); List<Long> ids = Arrays.asList(1L, 2L); request.setIds(ids); PublishMessageRequest failMsg = new PublishMessageRequest(); failMsg.setTopicName("test"); List<ProducerDataDto> msgs = new ArrayList<ProducerDataDto>(); ProducerDataDto producerDataDto = new ProducerDataDto(); producerDataDto.setBizId("test"); producerDataDto.setBody("test"); msgs.add(producerDataDto); failMsg.setMsgs(msgs); request.setFailMsg(failMsg); Map<Long, QueueEntity> queueMap = new HashMap<Long, QueueEntity>(); QueueEntity queueEntity = new QueueEntity(); queueEntity.setId(request.getQueueId()); queueEntity.setTopicName("test"); queueEntity.setNodeType(2); queueMap.put(request.getQueueId(), queueEntity); when(queueService.getAllQueueMap()).thenReturn(queueMap); consumerServiceImpl.publishAndUpdateResultFailMsg(request); verify(message01Service).deleteOldFailMsg(anyString(), anyLong(), anyInt()); verify(message01Service).updateFailMsgResult(anyString(), anyListOf(Long.class), anyInt()); }