1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.awt.tree;
25 
26 import com.sun.star.awt.tree.XMutableTreeDataModel;
27 import com.sun.star.awt.tree.XMutableTreeNode;
28 import lib.MultiMethodTest;
29 
30 /**
31 * Testing <code>com.sun.star.awt.tree.XMutableTreeDataModel</code>
32 * interface methods :
33 * <ul>
34 *  <li><code> createNode()</code></li>
35 *  <li><code> setRoot()</code></li>
36 * </ul> <p>
37 * Test is <b> NOT </b> multithread compilant. <p>
38 
39 * @see com.sun.star.awt.tree.XMutableTreeDataModel
40 */
41 public class _XMutableTreeDataModel extends MultiMethodTest {
42 
43     public XMutableTreeDataModel oObj = null;
44 
45     private XMutableTreeNode mNewNode = null;
46 
47     /**
48     * Sets the title to some string. <p>
49     * Has <b>OK</b> status if no runtime exceptions occurs.
50     */
_createNode()51     public void _createNode() {
52 
53         mNewNode = oObj.createNode("Hallo Welt", true);
54 
55         tRes.tested("createNode()", true) ;
56     }
57 
58     /**
59     * Gets the title and compares it to the value set in
60     * <code>setTitle</code> method test. <p>
61     * Has <b>OK</b> status is set/get values are equal.
62     * The following method tests are to be completed successfully before :
63     * <ul>
64     *  <li> <code> setTitle </code>  </li>
65     * </ul>
66     */
_setRoot()67     public void _setRoot() {
68         requiredMethod("createNode()") ;
69 
70         boolean bOK = true;
71         try {
72 
73             oObj.setRoot(mNewNode);
74         } catch (com.sun.star.lang.IllegalArgumentException ex) {
75             bOK = false;
76             log.println("ERROR: while trying to set a new root an IllegalArgumentException was thrown:\n" + ex.toString());
77         }
78 
79         try {
80 
81             oObj.setRoot(null);
82             bOK = false;
83             log.println("ERROR: while trying to set a null object as root expected IllegalArgumentException was not thrown.");
84         } catch (com.sun.star.lang.IllegalArgumentException ex) {
85             log.println("expected IllegalArgumentException was thrown => ok");
86 
87         }
88 
89         tRes.tested("setRoot()", bOK);
90 
91     }
92 
93 }
94 
95 
96