WeakEventListenerList implements Serializable { public Object[] getListenerList() { List<? extends EventListener> listeners = cleanReferences(); Object[] result = new Object[listeners.size() * 2]; for (int i = 0; i < listeners.size(); i++) { result[2*i + 1] = listeners.get(i); result[2*i] = getClasses().get(i); } return result; }  Object[] getListenerList(); @SuppressWarnings("unchecked") T[] getListeners(Class<T> t); synchronized void add(Class<T> t, T l); synchronized void remove(Class<T> t, T l);  }
@Test public void testGetListenerListInitial() { WeakEventListenerList list = new WeakEventListenerList(); assertNotNull("array must be not null", list.getListenerList()); assertEquals("array must be empty", 0, list.getListenerList().length); }