2 * Sun Public License Notice
4 * The contents of this file are subject to the Sun Public License
5 * Version 1.0 (the "License"). You may not use this file except in
6 * compliance with the License. A copy of the License is available at
9 * The Original Code is NetBeans. The Initial Developer of the Original
10 * Code is Sun Microsystems, Inc. Portions Copyright 1999-2006 Sun
11 * Microsystems, Inc. All Rights Reserved.
16 import javax.swing.event.ChangeEvent;
17 import junit.framework.TestCase;
18 import junit.framework.*;
20 import javax.swing.event.ChangeListener;
24 * @author Jaroslav Tulach
26 public class AccessorTest extends TestCase
27 implements ChangeListener {
31 public AccessorTest(String testName) {
35 protected void setUp() throws Exception {
38 protected void tearDown() throws Exception {
41 public void testGetTheItemAttachListenerChangeValue() {
42 // BEGIN: design.less.friend.use
43 Item item = Accessor.DEFAULT.newItem();
44 assertNotNull("Some item is really created", item);
46 Accessor.DEFAULT.addChangeListener(item, this);
47 // END: design.less.friend.use
50 assertEquals("Value is 10", 10, item.getValue());
53 assertEquals("Now it is 7", 7, item.getValue());
55 assertEquals("There was one change", 1, cnt);
58 public void stateChanged(ChangeEvent e) {