Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / beans / _XPropertyWithState.java
blob9f93e00209d7dffd64670d413f769ce4a2ac27fd
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 com.sun.star.beans.PropertyState;
22 import lib.MultiMethodTest;
24 import com.sun.star.beans.XPropertyWithState;
25 import lib.Status;
26 import lib.StatusException;
28 /**
29 * Testing <code>com.sun.star.beans.XPropertyWithState</code>
30 * interface methods :
31 * <ul>
32 * <li><code> getDefaultAsProperty()</code></li>
33 * <li><code> getStateAsProperty()</code></li>
34 * <li><code> setToDefaultAsProperty()</code></li>
35 * </ul> <p>
36 * @see com.sun.star.beans.XPropertyWithState
39 public class _XPropertyWithState extends MultiMethodTest {
41 /**
42 * the test object
44 public XPropertyWithState oObj;
47 /**
48 * Test calls the method.
49 * Test has ok status if no
50 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
51 * was thrown
53 public void _getDefaultAsProperty() {
54 try{
56 oObj.getDefaultAsProperty();
58 } catch (com.sun.star.lang.WrappedTargetException e){
59 throw new StatusException(e, Status.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
62 tRes.tested("getDefaultAsProperty()", true);
65 /**
66 * Test is ok if <CODE>getStateAsProperty()</CODE> returns
67 * as <CODE>PropertyState</CODE> which is not <CODE>null</CODE>
69 public void _getStateAsProperty() {
71 boolean res = true;
73 PropertyState propState = oObj.getStateAsProperty();
75 if (propState == null) {
76 log.println("the returned PropertyState is null -> FALSE");
77 res = false;
80 tRes.tested("getStateAsProperty()", res);
83 /**
84 * Test calls the method.
85 * Test has ok status if no
86 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
87 * was thrown
89 public void _setToDefaultAsProperty() {
90 try{
92 oObj.setToDefaultAsProperty();
94 } catch (com.sun.star.lang.WrappedTargetException e){
95 throw new StatusException(e, Status.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
98 tRes.tested("setToDefaultAsProperty()", true);