private void addHandlers(HandlerManager manager) {
manager.addHandler(MouseDownEvent.TYPE, mouse1);
manager.addHandler(MouseDownEvent.TYPE, mouse2);
manager.addHandler(MouseDownEvent.TYPE, adaptor1);
manager.fireEvent(new MouseDownEvent(null));
assertEquals(3, manager.getHandlerCount(MouseDownEvent.TYPE));
assertFired(mouse1, mouse2, adaptor1);
manager.addHandler(MouseDownEvent.TYPE, mouse3);
assertEquals(4, manager.getHandlerCount(MouseDownEvent.TYPE));
manager.addHandler(MouseDownEvent.TYPE, mouse1);
manager.addHandler(MouseDownEvent.TYPE, mouse2);
manager.addHandler(MouseDownEvent.TYPE, adaptor1);
// You can indeed add handlers twice, they will only be removed one at a
// time though.
assertEquals(7, manager.getHandlerCount(MouseDownEvent.TYPE));
manager.addHandler(ClickEvent.TYPE, adaptor1);
manager.addHandler(ClickEvent.TYPE, click1);
manager.addHandler(ClickEvent.TYPE, click2);
assertEquals(7, manager.getHandlerCount(MouseDownEvent.TYPE));
assertEquals(3, manager.getHandlerCount(ClickEvent.TYPE));
reset();
manager.fireEvent(new MouseDownEvent(null));
assertFired(mouse1, mouse2, mouse3, adaptor1);
assertNotFired(click1, click2);
}