### Question:
EventBusImpl implements EventBus { EventBusImpl() { super(); } EventBusImpl(); @Override synchronized void subscribe(final Object listener); @Override synchronized void unsubscribe(Object listener); @Override void publish(final Event event);  }### Answer:
@Test public void testEventBusImpl() { Mockery context = new Mockery(); Event fakeEvent = context.mock(Event.class); MockEventListener listener = new MockEventListener(); EventBus eventBus = new EventBusImpl(); eventBus.publish(new MockEvent()); assertEquals(0, invocationCount); eventBus.subscribe(listener); eventBus.publish(new MockEvent()); assertEquals(1, invocationCount); eventBus.publish(fakeEvent); assertEquals(1, invocationCount); eventBus.unsubscribe(listener); eventBus.publish(new MockEvent()); assertEquals(1, invocationCount); eventBus.subscribe(listener); eventBus.subscribe(listener); eventBus.publish(new MockEvent()); assertEquals(2, invocationCount); }