summaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr113630/case2/BeanTestCase.java
blob: 3f41ba44a2e28adadbd4476f1ee1ea974d41887a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

public class BeanTestCase implements PropertyChangeListener{

  public void propertyChange(PropertyChangeEvent e){
    System.out.println("Property [" + e.getPropertyName() + "[ changed from " +
			e.getOldValue() + " to " + e.getNewValue() );
  }
	
  public static void main(String [] argv) {
    new BeanTestCase().testPropertyChange();
  }

  public void testPropertyChange(){
    Bean b = new Bean();
    b.addPropertyChangeListener( "name", this );
    b.setName( "Test" );
    if (!b.getName().equals("Test")) throw new RuntimeException("");
    b.setName( "Test1" );
    if (!b.getName().equals("Test1")) throw new RuntimeException("");
  }
}