01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.beans;
19:
20: import junit.framework.TestCase;
21:
22: /**
23: * Test the internal class java.beans.NullPersistenceDelegate.
24: */
25: public class NullPersistenceDelegateTest extends TestCase {
26:
27: private PersistenceDelegate pd = null;
28:
29: private Encoder enc = null;
30:
31: @Override
32: public void setUp() throws Exception {
33: super .setUp();
34: enc = new Encoder();
35: pd = enc.getPersistenceDelegate(null);
36: }
37:
38: public void test_instantiate_LObject_LEncoder() throws Exception {
39: Expression exp = pd.instantiate(null, enc);
40: assertNull(exp);
41:
42: exp = pd.instantiate(new Object(), enc);
43: assertNull(exp);
44:
45: exp = pd.instantiate(null, null);
46: assertNull(exp);
47:
48: exp = pd.instantiate(new Object(), null);
49: assertNull(exp);
50: }
51:
52: public void test_mutatesTo_LObject_Object() {
53: assertFalse(pd.mutatesTo(null, null));
54: assertFalse(pd.mutatesTo(null, new Object()));
55: assertFalse(pd.mutatesTo(new Object(), null));
56:
57: Object o = new Object();
58: assertTrue(pd.mutatesTo(o, o));
59: assertTrue(pd.mutatesTo(new Object(), new Object()));
60: assertFalse(pd.mutatesTo(new Object(), new Integer(1)));
61: }
62:
63: public void test_writeObject_LObject_LEncoder() {
64: pd.writeObject(null, null);
65: }
66:
67: public void test_initialize() {
68: pd.initialize(null, null, null, null);
69: }
70:
71: }
|