Code example for PropertyChangeSupport

Methods: hasListeners

     * Test the method hasListeners(String) with a null parameter. 
    public void testHasListener_Null() { 
        Object src = new Object();
        PropertyChangeSupport sup = new PropertyChangeSupport(src);
        PropertyChangeListener l1 = new MockPropertyChangeListener();
        sup.addPropertyChangeListener("myProP", l1);
    public void testFireIndexedPropertyChange() { 
        final Object src = new Object();
        PropertyChangeSupport pcs = new PropertyChangeSupport(src);
        pcs.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                assertEquals(src, evt.getSource());
Contextual code suggestions in your IDE  Get Codota for Java