6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.beans.property;
27
28 import javafx.beans.InvalidationListenerMock;
29 import javafx.beans.value.ChangeListenerMock;
30
31 import org.junit.Before;
32 import org.junit.Test;
33
34 public class ReadOnlyObjectPropertyBaseTest {
35
36 private static final Object UNDEFINED = null;
37 private static final Object DEFAULT = null;
38 private static final Object VALUE_1 = new Object();
39 private static final Object VALUE_2 = new Object();
40
41 private ReadOnlyPropertyMock property;
42 private InvalidationListenerMock invalidationListener;
43 private ChangeListenerMock<Object> changeListener;
44
45 @Before
46 public void setUp() throws Exception {
47 property = new ReadOnlyPropertyMock();
48 invalidationListener = new InvalidationListenerMock();
49 changeListener = new ChangeListenerMock<Object>(UNDEFINED);
76 }
77
78 private static class ReadOnlyPropertyMock extends ReadOnlyObjectPropertyBase<Object> {
79
80 private Object value;
81
82 @Override
83 public Object getBean() {
84 // not used
85 return null;
86 }
87
88 @Override
89 public String getName() {
90 // not used
91 return null;
92 }
93
94 private void set(Object value) {
95 this.value = value;
96 fireValueChangedEvent();
97 }
98
99 @Override
100 public Object get() {
101 return value;
102 }
103
104 }
105
106 }
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.javafx.beans.property;
27
28 import javafx.beans.property.ReadOnlyObjectPropertyBase;
29 import javafx.beans.property.ReadOnlyObjectPropertyBaseShim;
30 import test.javafx.beans.InvalidationListenerMock;
31 import test.javafx.beans.value.ChangeListenerMock;
32
33 import org.junit.Before;
34 import org.junit.Test;
35
36 public class ReadOnlyObjectPropertyBaseTest {
37
38 private static final Object UNDEFINED = null;
39 private static final Object DEFAULT = null;
40 private static final Object VALUE_1 = new Object();
41 private static final Object VALUE_2 = new Object();
42
43 private ReadOnlyPropertyMock property;
44 private InvalidationListenerMock invalidationListener;
45 private ChangeListenerMock<Object> changeListener;
46
47 @Before
48 public void setUp() throws Exception {
49 property = new ReadOnlyPropertyMock();
50 invalidationListener = new InvalidationListenerMock();
51 changeListener = new ChangeListenerMock<Object>(UNDEFINED);
78 }
79
80 private static class ReadOnlyPropertyMock extends ReadOnlyObjectPropertyBase<Object> {
81
82 private Object value;
83
84 @Override
85 public Object getBean() {
86 // not used
87 return null;
88 }
89
90 @Override
91 public String getName() {
92 // not used
93 return null;
94 }
95
96 private void set(Object value) {
97 this.value = value;
98 ReadOnlyObjectPropertyBaseShim.fireValueChangedEvent(this);
99 }
100
101 @Override
102 public Object get() {
103 return value;
104 }
105
106 }
107
108 }
|