### Question:
ApplicationEventDistributionServiceImpl implements ApplicationEventDistributionService { @Override public void publishSynchronousEvent(@Nonnull final ApplicationEvent applicationEvent) { assertApplicationEventNotNull(applicationEvent); LOGGER.debug("Processing Synchronous event - {}", applicationEvent); final Runnable runnable = new EventListenersSynchronousIteratorTask(applicationEvent); runnable.run(); } ApplicationEventDistributionServiceImpl(); @Override void subscribe(@Nonnull final ApplicationEventListener eventListener); @Override void publishAsynchronousEvent(@Nonnull final ApplicationEvent applicationEvent); @Override void publishSynchronousEvent(@Nonnull final ApplicationEvent applicationEvent); PersistenceUtilityService getPersistenceUtilityService(); void setPersistenceUtilityService(final PersistenceUtilityService persistenceUtilityService); void setExecutorService(final ExecutorService executorService);  }### Answer:
@Test public void testPublishSynchronousEventWithInvalidArguments() { resetAll(); replayAll(); try { applicationEventDistributionService.publishSynchronousEvent(null); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } verifyAll(); }
@Test public void testPublishSynchronousEvent() { final Long stationId = 1l; final ApplicationEvent applicationEvent = new MockApplicationEvent(); resetAll(); expect(applicationEventListener.subscribed(eq(applicationEvent))).andReturn(true).once(); applicationEventListener.process(eq(applicationEvent)); expectLastCall().once(); persistenceUtilityService.runInNewTransaction(isA(Runnable.class)); expectLastCall().andAnswer(() -> { final Runnable runnable = (Runnable) getCurrentArguments()[0]; runnable.run(); return null; }).once(); replayAll(); applicationEventDistributionService.subscribe(applicationEventListener); applicationEventDistributionService.publishSynchronousEvent(applicationEvent); verifyAll(); }