@Override protected void fireEvent(EventObject event) { super.fireEvent(event); // Validate listeners automatically. ctxtListener2.validate(); contextListener.validate(); }
/** Multiple listeners should get fitting events. */ @Test public void testMultipleListenerGetEvents() { addContextClickListener(ctxtListener2); addContextClickListener(contextListener); ctxtListener2.expect(GridContextClickEvent.class); contextListener.expect(GridContextClickEvent.class); fireEvent(gridContextClickEvent); }
@Test public void testAddAndRemoveMultipleListeners() { addContextClickListener(ctxtListener2); addContextClickListener(contextListener); ctxtListener2.expect(GridContextClickEvent.class); contextListener.expect(GridContextClickEvent.class); fireEvent(gridContextClickEvent); removeContextClickListener(ctxtListener2); contextListener.expect(GridContextClickEvent.class); fireEvent(gridContextClickEvent); }
@Test public void testAddAndRemoveListener() { addContextClickListener(contextListener); contextListener.expect(ContextClickEvent.class); fireEvent(contextClickEvent); removeContextClickListener(contextListener); fireEvent(contextClickEvent); }
@Test public void testListenerGetsExactClass() { addContextClickListener(contextListener); contextListener.expect(ContextClickEvent.class); fireEvent(contextClickEvent); }
@Test public void testListenerGetsASubClass() { addContextClickListener(contextListener); contextListener.expect(GridContextClickEvent.class); fireEvent(gridContextClickEvent); }
@Test(expected = AssertionError.class) public void testExpectedEventNotReceived() { addContextClickListener(contextListener); contextListener.expect(GridContextClickEvent.class); fireEvent(contextClickEvent); }