bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / beans / _XPropertySetInfo.java
blobfd47b8bf63e598e5a1e4649ac9c530290542b057
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.beans;
21 import lib.MultiMethodTest;
23 import com.sun.star.beans.Property;
24 import com.sun.star.beans.UnknownPropertyException;
25 import com.sun.star.beans.XPropertySetInfo;
27 /**
28 * Testing <code>com.sun.star.beans.XPropertySetInfo</code>
29 * interface methods :
30 * <ul>
31 * <li><code>getProperties()</code></li>
32 * <li><code>getPropertyByName()</code></li>
33 * <li><code>hasPropertyByName()</code></li>
34 * </ul>
35 * @see com.sun.star.beans.XPropertySetInfo
37 public class _XPropertySetInfo extends MultiMethodTest {
39 public XPropertySetInfo oObj = null;// oObj filled by MultiMethodTest
41 public Property IsThere = null;
43 /**
44 * Test calls the method and stores one of the properties.<p>
45 * Has <b> OK </b> status if the method successfully returns
46 * value that isn't null.<p>
48 public void _getProperties() {
49 Property[] properties = oObj.getProperties();
50 IsThere = properties[0];
51 tRes.tested("getProperties()", ( properties != null ));
52 return;
55 /**
56 * Test calls the method with property name that certainly present
57 * in the property set and again calls the method with property name
58 * that certainly doesn't present in the property set.<p>
59 * Has <b> OK </b> status if the method in one case successfully
60 * returns value that isn't null and no exceptions were thrown and
61 * in other case exception was thrown.<p>
62 * The following method tests are to be completed successfully before :
63 * <ul>
64 * <li> <code>getProperties()</code> : to have a property that certainly
65 * present in the property set</li>
66 * </ul>
68 public void _getPropertyByName() {
69 requiredMethod("getProperties()");
70 boolean result;
71 try {
72 Property prop = oObj.getPropertyByName(IsThere.Name);
73 result = (prop != null);
74 } catch (com.sun.star.beans.UnknownPropertyException e) {
75 log.println("Exception occurred while testing" +
76 " getPropertyByName with existing property");
77 e.printStackTrace(log);
78 result = false;
81 try {
82 oObj.getPropertyByName("Jupp");
83 log.println("No Exception thrown while testing"+
84 " getPropertyByName with non existing property");
85 result = false;
87 catch (UnknownPropertyException e) {
88 result = true;
90 tRes.tested("getPropertyByName()", result);
91 return;
94 /**
95 * Test calls the method with property name that certainly present
96 * in the property set and again calls the method with property name
97 * that certainly doesn't present in the property set.<p>
98 * Has <b> OK </b> status if the method successfully returns true in
99 * one case and false in other case.<p>
100 * The following method tests are to be completed successfully before :
101 * <ul>
102 * <li> <code>getProperties()</code> : to have a property that certainly
103 * present in the property set</li>
104 * </ul>
106 public void _hasPropertyByName() {
107 requiredMethod("getProperties()");
108 tRes.tested("hasPropertyByName()",
110 (oObj.hasPropertyByName(IsThere.Name)) &&
111 (!oObj.hasPropertyByName("Jupp")) )
115 } /// finish class XPropertySetInfo