### Question:
TextComponentMatcherEditor extends TextMatcherEditor<E> { public void dispose() { deregisterListeners(live); } TextComponentMatcherEditor(JTextComponent textComponent, TextFilterator<? super E> textFilterator);  TextComponentMatcherEditor(JTextComponent textComponent, TextFilterator<? super E> textFilterator, boolean live);  TextComponentMatcherEditor(Document document, TextFilterator<? super E> textFilterator); private  TextComponentMatcherEditor(JTextComponent textComponent, Document document, TextFilterator<? super E> textFilterator, boolean live); boolean isLive(); void setLive(boolean live); void dispose();  }### Answer:
@Test public void testDispose() { eventCounter.assertNoEvents(0); boolean[] liveOptions = { true, false }; for (int b = 0; b < liveOptions.length; b++) { JTextField textField = new JTextField(); TextComponentMatcherEditor<String> textMatcherEditor = new TextComponentMatcherEditor<>(textField, GlazedLists.toStringTextFilterator(), liveOptions[b]); textField.setText("DEF"); textField.postActionEvent(); assertTrue(textMatcherEditor.getMatcher().matches("TONEDEF")); assertFalse(textMatcherEditor.getMatcher().matches("STUPID")); textMatcherEditor.dispose(); textField.setText("STU"); textField.postActionEvent(); assertTrue(textMatcherEditor.getMatcher().matches("TONEDEF")); assertFalse(textMatcherEditor.getMatcher().matches("STUPID")); } }
@Test public void testListeners() { final JTextField textField = new JTextField(); final AbstractDocument document = (AbstractDocument) textField.getDocument(); final int originalPropertyChangeListenerCount = textField.getPropertyChangeListeners().length; final int originalActionListenerCount = textField.getActionListeners().length; final int originalDocumentListenerCount = document.getDocumentListeners().length; TextComponentMatcherEditor<String> textMatcherEditor = new TextComponentMatcherEditor<>(textField, GlazedLists.toStringTextFilterator(), true); assertEquals(originalPropertyChangeListenerCount+1, textField.getPropertyChangeListeners().length); assertEquals(originalActionListenerCount, textField.getActionListeners().length); assertEquals(originalDocumentListenerCount+1, document.getDocumentListeners().length); textMatcherEditor.dispose(); assertEquals(originalPropertyChangeListenerCount, textField.getPropertyChangeListeners().length); assertEquals(originalActionListenerCount, textField.getActionListeners().length); assertEquals(originalDocumentListenerCount, document.getDocumentListeners().length); textMatcherEditor = new TextComponentMatcherEditor<>(textField, GlazedLists.toStringTextFilterator(), false); assertEquals(originalPropertyChangeListenerCount+1, textField.getPropertyChangeListeners().length); assertEquals(originalActionListenerCount+1, textField.getActionListeners().length); assertEquals(originalDocumentListenerCount, document.getDocumentListeners().length); textMatcherEditor.dispose(); assertEquals(originalPropertyChangeListenerCount, textField.getPropertyChangeListeners().length); assertEquals(originalActionListenerCount, textField.getActionListeners().length); assertEquals(originalDocumentListenerCount, document.getDocumentListeners().length); }