VersionEventPublisher { public void publish(ClusterEvent event) { m_eventBus.post(event); } VersionEventPublisher(); void publish(ClusterEvent event); void register(Object object);  }
@Test public void testPublish() throws Exception { Cluster cluster = createNiceMock(Cluster.class); ServiceComponentHost sch = createNiceMock(ServiceComponentHost.class); expect(cluster.getClusterId()).andReturn(99L); replay(cluster, sch); VersionEventPublisher publisher = injector.getInstance(VersionEventPublisher.class); Listener listener = injector.getInstance(Listener.class); HostComponentVersionAdvertisedEvent event = new HostComponentVersionAdvertisedEvent(cluster, sch, "1.2.3.4-5678"); publisher.publish(event); assertEquals(event, listener.getLastEvent()); verify(cluster, sch); }