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 Jaroslav Tulach. Portions Copyright 2007 Jaroslav Tulach.
11 * All Rights Reserved.
14 package org.apidesign.friendpackage.impl;
16 import javax.swing.event.ChangeEvent;
17 import javax.swing.event.ChangeListener;
18 import junit.framework.TestCase;
19 import org.apidesign.friendpackage.api.Item;
23 * @author Jaroslav Tulach
25 public class AccessorTest extends TestCase
26 implements ChangeListener {
30 public AccessorTest(String testName) {
34 public void testGetTheItemAttachListenerChangeValue() {
35 // BEGIN: design.less.friend.use
36 Item item = Accessor.getDefault().newItem();
37 assertNotNull("Some item is really created", item);
39 Accessor.getDefault().addChangeListener(item, this);
40 // END: design.less.friend.use
43 assertEquals("Value is 10", 10, item.getValue());
46 assertEquals("Now it is 7", 7, item.getValue());
48 assertEquals("There was one change", 1, cnt);
51 public void stateChanged(ChangeEvent e) {