@Test public void testSendEvents() throws Exception { JmsTemplate jmsTemplate = Mockito.mock(JmsTemplate.class); ContentConverter contentConverter = Mockito.mock(ContentConverter.class); Mockito.doNothing().when(jmsTemplate).convertAndSend(Mockito.anyString(), Mockito.any(Object.class)); EventManager eventManager = new EventManager(contentConverter, jmsTemplate); LinkableItem subTopic = new LinkableItem("subTopic", "sub topic", null); ProviderMessageContent content = new ProviderMessageContent.Builder() .applyProvider("1", 1L, "providerConfig") .applyTopic("testTopic", "topic") .applySubTopic(subTopic.getName(), subTopic.getValue()) .build(); FieldUtility fieldUtility = new FieldUtility(Map.of()); DistributionEvent event = new DistributionEvent(UUID.randomUUID().toString(), "destination", RestConstants.formatDate(new Date()), 1L, "FORMAT", MessageContentGroup.singleton(content), fieldUtility); eventManager.sendEvents(List.of(event)); }
@Transactional public void sendEvents(List<? extends AlertEvent> eventList) { if (!eventList.isEmpty()) { eventList.forEach(this::sendEvent); } }
EventManager { @Transactional public void sendEvents(List<? extends AlertEvent> eventList) { if (!eventList.isEmpty()) { eventList.forEach(this::sendEvent); } } }
EventManager { @Transactional public void sendEvents(List<? extends AlertEvent> eventList) { if (!eventList.isEmpty()) { eventList.forEach(this::sendEvent); } } @Autowired  EventManager(ContentConverter contentConverter, JmsTemplate jmsTemplate); }
EventManager { @Transactional public void sendEvents(List<? extends AlertEvent> eventList) { if (!eventList.isEmpty()) { eventList.forEach(this::sendEvent); } } @Autowired  EventManager(ContentConverter contentConverter, JmsTemplate jmsTemplate); @Transactional void sendEvents(List<? extends AlertEvent> eventList); @Transactional void sendEvent(AlertEvent event); JmsTemplate getJmsTemplate(); ContentConverter getContentConverter(); }
EventManager { @Transactional public void sendEvents(List<? extends AlertEvent> eventList) { if (!eventList.isEmpty()) { eventList.forEach(this::sendEvent); } } @Autowired  EventManager(ContentConverter contentConverter, JmsTemplate jmsTemplate); @Transactional void sendEvents(List<? extends AlertEvent> eventList); @Transactional void sendEvent(AlertEvent event); JmsTemplate getJmsTemplate(); ContentConverter getContentConverter();  }