public void testEventBinder_unbindEventHandlers() {
EventBus eventBus = new SimpleEventBus();
TestPresenter presenter = new TestPresenter();
TestPresenter.MyEventBinder binder = GWT.create(TestPresenter.MyEventBinder.class);
HandlerRegistration registration = binder.bindEventHandlers(presenter, eventBus);
assertEquals(0, presenter.firstEventsHandled);
assertEquals(0, presenter.firstEventsWithoutParameterHandled);
assertEquals(0, presenter.secondEventsHandled);
// Before unregistering
eventBus.fireEvent(new FirstEvent());
eventBus.fireEvent(new SecondEvent());
assertEquals(1, presenter.firstEventsHandled);
assertEquals(1, presenter.firstEventsWithoutParameterHandled);
assertEquals(1, presenter.secondEventsHandled);
assertEquals(2, presenter.firstAndSecondEventsHandled);
// After unregistering
registration.removeHandler();
eventBus.fireEvent(new FirstEvent());
eventBus.fireEvent(new SecondEvent());
assertEquals(1, presenter.firstEventsHandled);
assertEquals(1, presenter.firstEventsWithoutParameterHandled);
assertEquals(1, presenter.secondEventsHandled);