DeliveryNotificationSenderManager { public void sendMessage(Delivery delivery) { final List<DeliveryNotificationType> notifications = delivery.getDeliveryNotificationTypes(); if (!notifications.isEmpty()) for (DeliveryNotificationType type : notifications) getInstanceByType(type).send(buildMessage(delivery)); } @Autowired  DeliveryNotificationSenderManager(DeliveryNotificationSenderFactory deliveryNotificationSenderFactory); void sendMessage(Delivery delivery);  }
@Test public void sendMessage() { deliveryNotificationSenderManager.sendMessage(delivery); verify(deliveryKakaoNotificationSender, atLeastOnce()).send(any(DeliveryMessageDto.Message.class)); verify(deliverySmsNotificationSender, atLeastOnce()).send(any(DeliveryMessageDto.Message.class)); }