01: /*******************************************************************************
02: * Copyright (c) 2006, 2007 IBM Corporation 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: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.core.tests.databinding.observable;
11:
12: import java.util.Set;
13:
14: import junit.framework.TestCase;
15:
16: import org.eclipse.core.databinding.observable.set.SetDiff;
17: import org.eclipse.core.databinding.observable.value.ValueDiff;
18:
19: /**
20: * @since 3.2
21: *
22: */
23: public class DiffsTest extends TestCase {
24: /**
25: * Asserts that the {@link SetDiff#toString()} implementation doesn't throw a NPE if any of its properties are <code>null</code>.
26: */
27: public void test_SetDiff() {
28: SetDiff diff = new SetDiff() {
29: public Set getAdditions() {
30: return null;
31: }
32:
33: public Set getRemovals() {
34: return null;
35: }
36: };
37:
38: try {
39: diff.toString();
40: assertTrue(true);
41: } catch (NullPointerException e) {
42: fail("NPE was thrown.");
43: }
44: }
45:
46: /**
47: * Asserts that if the {@link ValueDiff#toString()} implementation doesn't throw a NPE if any of its properties are <code>null</code>.
48: *
49: */
50: public void test_ValueDiff() {
51: ValueDiff diff = new ValueDiff() {
52: public Object getNewValue() {
53: return null;
54: }
55:
56: public Object getOldValue() {
57: return null;
58: }
59: };
60:
61: try {
62: diff.toString();
63: assertTrue(true);
64: } catch (NullPointerException e) {
65: fail("NPE was thrown.");
66: }
67: }
68:
69: }
|