1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.awt.tree;
29 
30 import com.sun.star.awt.tree.XMutableTreeDataModel;
31 import com.sun.star.awt.tree.XMutableTreeNode;
32 import lib.MultiMethodTest;
33 
34 /**
35 * Testing <code>com.sun.star.awt.tree.XMutableTreeDataModel</code>
36 * interface methods :
37 * <ul>
38 *  <li><code> createNode()</code></li>
39 *  <li><code> setRoot()</code></li>
40 * </ul> <p>
41 * Test is <b> NOT </b> multithread compilant. <p>
42 
43 * @see com.sun.star.awt.tree.XMutableTreeDataModel
44 */
45 public class _XMutableTreeDataModel extends MultiMethodTest {
46 
47     public XMutableTreeDataModel oObj = null;
48 
49     private XMutableTreeNode mNewNode = null;
50 
51     /**
52     * Sets the title to some string. <p>
53     * Has <b>OK</b> status if no runtime exceptions occurs.
54     */
55     public void _createNode() {
56 
57         mNewNode = oObj.createNode("Hallo Welt", true);
58 
59         tRes.tested("createNode()", true) ;
60     }
61 
62     /**
63     * Gets the title and compares it to the value set in
64     * <code>setTitle</code> method test. <p>
65     * Has <b>OK</b> status is set/get values are equal.
66     * The following method tests are to be completed successfully before :
67     * <ul>
68     *  <li> <code> setTitle </code>  </li>
69     * </ul>
70     */
71     public void _setRoot() {
72         requiredMethod("createNode()") ;
73 
74         boolean bOK = true;
75         try {
76 
77             oObj.setRoot(mNewNode);
78         } catch (com.sun.star.lang.IllegalArgumentException ex) {
79             bOK = false;
80             log.println("ERROR: while trying to set a new root an IllegalArgumentException was thrown:\n" + ex.toString());
81         }
82 
83         try {
84 
85             oObj.setRoot(null);
86             bOK = false;
87             log.println("ERROR: while trying to set a null object as root expected IllegalArgumentException was not thrown.");
88         } catch (com.sun.star.lang.IllegalArgumentException ex) {
89             log.println("expected IllegalArgumentException was thrown => ok");
90 
91         }
92 
93         tRes.tested("setRoot()", bOK);
94 
95     }
96 
97 }
98 
99 
100