1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.beans
.Property
;
33 import com
.sun
.star
.beans
.UnknownPropertyException
;
34 import com
.sun
.star
.beans
.XPropertySetInfo
;
37 * Testing <code>com.sun.star.beans.XPropertySetInfo</code>
40 * <li><code>getProperties()</code></li>
41 * <li><code>getPropertyByName()</code></li>
42 * <li><code>hasPropertyByName()</code></li>
44 * @see com.sun.star.beans.XPropertySetInfo
46 public class _XPropertySetInfo
extends MultiMethodTest
{
48 public XPropertySetInfo oObj
= null;// oObj filled by MultiMethodTest
50 public Property IsThere
= null;
53 * Test calls the method and stores one of the properties.<p>
54 * Has <b> OK </b> status if the method successfully returns
55 * value that isn't null.<p>
57 public void _getProperties() {
58 Property
[] properties
= oObj
.getProperties();
59 IsThere
= properties
[0];
60 tRes
.tested("getProperties()", ( properties
!= null ));
65 * Test calls the method with property name that certainly present
66 * in the property set and again calls the method with property name
67 * that certainly doesn't present in the property set.<p>
68 * Has <b> OK </b> status if the method in one case successfully
69 * returns value that isn't null and no exceptions were thrown and
70 * in other case exception was thrown.<p>
71 * The following method tests are to be completed successfully before :
73 * <li> <code>getProperties()</code> : to have a property that certainly
74 * present in the property set</li>
77 public void _getPropertyByName() {
78 requiredMethod("getProperties()");
81 Property prop
= oObj
.getPropertyByName(IsThere
.Name
);
82 result
= (prop
!= null);
83 } catch (com
.sun
.star
.beans
.UnknownPropertyException e
) {
84 log
.println("Exception occurred while testing" +
85 " getPropertyByName with existing property");
86 e
.printStackTrace(log
);
91 oObj
.getPropertyByName("Jupp");
92 log
.println("No Exception thrown while testing"+
93 " getPropertyByName with non existing property");
96 catch (UnknownPropertyException e
) {
99 tRes
.tested("getPropertyByName()", result
);
104 * Test calls the method with property name that certainly present
105 * in the property set and again calls the method with property name
106 * that certainly doesn't present in the property set.<p>
107 * Has <b> OK </b> status if the method successfully returns true in
108 * one case and false in other case.<p>
109 * The following method tests are to be completed successfully before :
111 * <li> <code>getProperties()</code> : to have a property that certainly
112 * present in the property set</li>
115 public void _hasPropertyByName() {
116 requiredMethod("getProperties()");
117 tRes
.tested("hasPropertyByName()",
119 (oObj
.hasPropertyByName(IsThere
.Name
)) &&
120 (!oObj
.hasPropertyByName("Jupp")) )
124 } /// finish class XPropertySetInfo