01: /*******************************************************************************
02: * Copyright (c) 2007 Brad Reynolds and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Brad Reynolds - initial API and implementation
10: ******************************************************************************/package org.eclipse.core.tests.internal.databinding.internal.beans;
11:
12: import java.beans.PropertyDescriptor;
13:
14: import junit.framework.TestCase;
15:
16: import org.eclipse.core.internal.databinding.internal.beans.BeanObservableSetDecorator;
17: import org.eclipse.core.internal.databinding.internal.beans.JavaBeanObservableSet;
18: import org.eclipse.jface.databinding.swt.SWTObservables;
19: import org.eclipse.swt.widgets.Display;
20:
21: /**
22: * @since 3.3
23: */
24: public class BeanObservableSetDecoratorTest extends TestCase {
25: private PropertyDescriptor propertyDescriptor;
26: private JavaBeanObservableSet observableSet;
27: private BeanObservableSetDecorator decorator;
28:
29: /*
30: * (non-Javadoc)
31: *
32: * @see junit.framework.TestCase#setUp()
33: */
34: protected void setUp() throws Exception {
35: super .setUp();
36:
37: Bean bean = new Bean();
38: propertyDescriptor = new PropertyDescriptor("set", Bean.class);
39: observableSet = new JavaBeanObservableSet(SWTObservables
40: .getRealm(Display.getDefault()), bean,
41: propertyDescriptor, String.class);
42: decorator = new BeanObservableSetDecorator(observableSet,
43: observableSet, propertyDescriptor);
44: }
45:
46: public void testGetDelegate() throws Exception {
47: assertEquals(observableSet, decorator.getDelegate());
48: }
49:
50: public void testGetObserved() throws Exception {
51: assertEquals(observableSet, decorator.getObserved());
52: }
53:
54: public void testGetPropertyDescriptor() throws Exception {
55: assertEquals(propertyDescriptor, decorator
56: .getPropertyDescriptor());
57: }
58: }
|