use of java.beans.PropertyChangeListenerProxy in project robovm by robovm.
the class PropertyChangeSupportTest method testAddingAListenerActuallyAddsAProxy.
public void testAddingAListenerActuallyAddsAProxy() {
Object bean = new Object();
PropertyChangeSupport support = new PropertyChangeSupport(bean);
PropertyChangeListener listener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
}
};
support.addPropertyChangeListener("a", listener);
PropertyChangeListenerProxy p1 = (PropertyChangeListenerProxy) support.getPropertyChangeListeners()[0];
assertEquals(PropertyChangeListenerProxy.class, p1.getClass());
// weird but consistent with the RI
assertTrue(p1 != listener);
assertEquals("a", p1.getPropertyName());
assertEquals(listener, p1.getListener());
}
use of java.beans.PropertyChangeListenerProxy in project jdk8u_jdk by JetBrains.
the class TestSerialization method check.
private static void check(PropertyChangeListener listener, int index, String name) {
if (!(listener instanceof PropertyChangeListenerProxy))
throw new Error("Unexpected listener: " + listener);
PropertyChangeListenerProxy object = (PropertyChangeListenerProxy) listener;
if (!name.equals(object.getPropertyName()))
throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());
check((PropertyChangeListener) object.getListener(), index);
}
use of java.beans.PropertyChangeListenerProxy in project j2objc by google.
the class PropertyChangeListenerProxyTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
proxy = new PropertyChangeListenerProxy(name, listener);
}
use of java.beans.PropertyChangeListenerProxy in project j2objc by google.
the class PropertyChangeListenerProxyTest method testPropertyChangeListenerProxy.
public void testPropertyChangeListenerProxy() {
proxy = new PropertyChangeListenerProxy(null, listener);
assertSame(listener, proxy.getListener());
assertNull(proxy.getPropertyName());
PropertyChangeEvent newevent = new PropertyChangeEvent(new Object(), "name", new Object(), new Object());
proxy.propertyChange(newevent);
assertSame(newevent, event);
proxy = new PropertyChangeListenerProxy(name, null);
assertSame(name, proxy.getPropertyName());
assertNull(proxy.getListener());
try {
proxy.propertyChange(new PropertyChangeEvent(new Object(), "name", new Object(), new Object()));
fail("NullPointerException expected");
} catch (NullPointerException e) {
}
proxy = new PropertyChangeListenerProxy(name, listener);
assertSame(listener, proxy.getListener());
assertSame(name, proxy.getPropertyName());
newevent = new PropertyChangeEvent(new Object(), "name", new Object(), new Object());
assertSame(name, proxy.getPropertyName());
proxy.propertyChange(newevent);
assertSame(newevent, event);
}
use of java.beans.PropertyChangeListenerProxy in project j2objc by google.
the class PropertyChangeListenerProxyTest method testPropertyChange_PropertyChangeEvent.
/**
* Regression for HARMONY-407
*/
public void testPropertyChange_PropertyChangeEvent() {
PropertyChangeListenerProxy proxy = new PropertyChangeListenerProxy("harmony", null);
try {
proxy.propertyChange(null);
fail("NullPointerException expected");
} catch (NullPointerException e) {
}
}
Aggregations