### Question:
JobEventBus { public void post(final JobEvent event) { if (isRegistered && !executorServiceObject.isShutdown()) { eventBus.post(event); } } JobEventBus();  JobEventBus(final JobEventConfiguration jobEventConfig); void post(final JobEvent event);  }### Answer:
@Test public void assertPost() throws InterruptedException, NoSuchFieldException { jobEventBus = new JobEventBus(new TestJobEventConfiguration(jobEventCaller)); assertIsRegistered(true); jobEventBus.post(new JobExecutionEvent("fake_task_id", "test_event_bus_job", JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0)); while (!TestJobEventListener.isExecutionEventCalled()) { Thread.sleep(100L); } Mockito.verify(jobEventCaller).call(); }
@Test public void assertPostWithoutListener() throws NoSuchFieldException { jobEventBus = new JobEventBus(); assertIsRegistered(false); ReflectionUtils.setFieldValue(jobEventBus, "eventBus", eventBus); jobEventBus.post(new JobExecutionEvent("fake_task_id", "test_event_bus_job", JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0)); Mockito.verify(eventBus, Mockito.times(0)).post(ArgumentMatchers.<JobEvent>any()); }