Code example for EventBus

Methods: postregister

0
 
    @Test
    public void shouldReceiveEvent() throws Exception {
 
        // given 
        EventBus eventBus = new EventBus("test");
        EventListener listener = new EventListener(); 
 
        eventBus.register(listener);
 
        // when 
        eventBus.post(new OurTestEvent(200));
 
        // then 
        assertThat(listener.getLastMessage()).isEqualTo(200); 
    } 
 
    @Test
    public void shouldReceiveMultipleEvents() throws Exception {
 
Experience pair programming with AI  Get Codota for Java