@Test
public void test_weakListener() {
ActionListener listener = mock(ActionListener.class);
JButton button = mock(JButton.class);
ActionListener weakListener = WeakReferences.weakListener(ActionListener.class, listener, button);
weakListener.actionPerformed(mock(ActionEvent.class));
verify(listener, times(1)).actionPerformed(any(ActionEvent.class));
listener = null;
System.gc();
weakListener.actionPerformed(mock(ActionEvent.class));
verify(button, times(1)).removeActionListener(eq(weakListener));