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.BeanObservableListDecorator;
17: import org.eclipse.core.internal.databinding.internal.beans.JavaBeanObservableList;
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 BeanObservableListDecoratorTest extends TestCase {
25: private PropertyDescriptor propertyDescriptor;
26: private JavaBeanObservableList observableList;
27: private BeanObservableListDecorator 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("list", Bean.class,
39: "getList", "setList");
40: observableList = new JavaBeanObservableList(SWTObservables
41: .getRealm(Display.getDefault()), bean,
42: propertyDescriptor, Bean.class);
43: decorator = new BeanObservableListDecorator(observableList,
44: observableList, propertyDescriptor);
45: }
46:
47: public void testGetDelegate() throws Exception {
48: assertEquals(observableList, decorator.getDelegate());
49: }
50:
51: public void testGetObserved() throws Exception {
52: assertEquals(observableList, decorator.getObserved());
53: }
54:
55: public void testGetPropertyDescriptor() throws Exception {
56: assertEquals(propertyDescriptor, decorator
57: .getPropertyDescriptor());
58: }
59: }
|