### Question:
EmailServiceImpl implements EmailService { @Override public void sendConsumerMail(SendMailRequest request) { sendByConsumer(request); addLogMsg(request); }  @Override void sendConsumerMail(SendMailRequest request); @Override void sendProduceMail(SendMailRequest request);  }### Answer:
@Test public void sendConsumerMailTest() { SendMailRequest sendMailRequest=new SendMailRequest(); sendMailRequest.setConsumerGroupName("test"); sendMailRequest.setTopicName("test"); sendMailRequest.setType(1); sendMailRequest.setSubject("test"); Map<String, ConsumerGroupEntity> map =new HashMap<String, ConsumerGroupEntity>(); ConsumerGroupEntity consumerGroupEntity=new ConsumerGroupEntity(); map.put(sendMailRequest.getConsumerGroupName(), consumerGroupEntity); when(consumerGroupService.getCache()).thenReturn(map); ConsumerGroupTopicEntity topicEntity=new ConsumerGroupTopicEntity(); topicEntity.setAlarmEmails("fasfas@com"); when(consumerGroupService.getTopic(anyString(),anyString())).thenReturn(topicEntity); emailServiceImpl.sendConsumerMail(sendMailRequest); verify(emailUtil).sendMail(anyString(),anyString(),anyListOf(String.class),anyInt()); sendMailRequest=new SendMailRequest(); sendMailRequest.setType(1); sendMailRequest.setSubject("test"); emailServiceImpl.sendConsumerMail(sendMailRequest); verify(emailUtil,times(2)).sendMail(anyString(),anyString(),anyListOf(String.class),anyInt()); }