Code example for EventBus

Methods: postregister

0
 
    @Test
    public void shouldReceiveMultipleEvents() throws Exception {
 
        // given 
        EventBus eventBus = new EventBus("test");
        MultipleListener multiListener = new MultipleListener();
 
        eventBus.register(multiListener);
 
 
        // when 
        eventBus.post(new Integer(100));
        eventBus.post(new Long(800));
 
        // then 
        assertThat(multiListener.getLastInteger()).isEqualTo(100);
        assertThat(multiListener.getLastLong()).isEqualTo(800L);
    }