public void testGarbageCollectWeakReferenceProxy() {
final TextMatcherEditor<String> textMatcherEditor = new TextMatcherEditor<String>();
MatcherEditor<String> weakMatcherEditor = Matchers.weakReferenceProxy(textMatcherEditor);
final CountingMatcherEditorListener counter = new CountingMatcherEditorListener();
weakMatcherEditor.addMatcherEditorListener(counter);
counter.assertCounterState(0, 0, 0, 0, 0);
textMatcherEditor.setFilterText(new String[] {"booblah"});
counter.assertCounterState(0, 0, 0, 1, 0);
// removing the only hard reference to weakMatcherEditor should make it gc'able
weakMatcherEditor = null;
System.gc();
textMatcherEditor.setFilterText(new String[] {"bibbety"});
counter.assertCounterState(0, 0, 0, 1, 0);
}