### Question:
ConsumerServiceImpl extends AbstractBaseService<ConsumerEntity> implements ConsumerService { protected void registConsumerGroupConsumer(List<ConsumerGroupConsumerEntity> consumerGroupConsumerEntities) { try { if (CollectionUtils.isEmpty(consumerGroupConsumerEntities)) { return; } consumerGroupConsumerService.insertBatch(consumerGroupConsumerEntities); } catch (Exception e) { consumerGroupConsumerEntities.forEach(t1 -> { try { consumerGroupConsumerService.insert(t1); } catch (Exception e1) { } }); } }  @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 registConsumerGroupConsumerTest() { doThrow(new RuntimeException()).when(consumerGroupConsumerService) .insertBatch(anyListOf(ConsumerGroupConsumerEntity.class)); List<ConsumerGroupConsumerEntity> consumerGroupConsumerEntities = new ArrayList<ConsumerGroupConsumerEntity>(2); consumerGroupConsumerEntities.add(new ConsumerGroupConsumerEntity()); consumerServiceImpl.registConsumerGroupConsumer(consumerGroupConsumerEntities); verify(consumerGroupConsumerService).insert(any(ConsumerGroupConsumerEntity.class)); }