### Question:
Listeners { @SuppressWarnings("unchecked") public static <E> void notifyAll(E event) { Preconditions.checkNotNull(event, "Cannot notify listeners for a null event."); List<Listener<?>> list = listeners.get(event.getClass()); if (list != null) { Iterator<Listener<?>> iter = list.iterator(); while (iter.hasNext()) { Listener<E> listener = (Listener<E>) iter.next(); listener.notify(event); } } } private  Listeners(); static void register(Listener<E> listener, Class<E> eventType); @SuppressWarnings("unchecked") static void notifyAll(E event);  }### Answer:
@Test public void testEvent1() { Event1 e1 = new Event1(); Listeners.notifyAll(e1); Assert.assertEquals(e1, TestListener.get().e1); }
@Test public void testEvent2() { Event2 e2 = new Event2(); Listeners.notifyAll(e2); Assert.assertEquals(e2, TestListener.get().e2); }