1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XPropertyWithState.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import com
.sun
.star
.beans
.PropertyState
;
34 import com
.sun
.star
.uno
.XInterface
;
35 import lib
.MultiMethodTest
;
37 import com
.sun
.star
.beans
.XPropertyWithState
;
39 import lib
.StatusException
;
42 * Testing <code>com.sun.star.beans.XPropertyWithState</code>
45 * <li><code> getDefaultAsProperty()</code></li>
46 * <li><code> getStateAsProperty()</code></li>
47 * <li><code> setToDefaultAsProperty()</code></li>
49 * @see com.sun.star.beans.XPropertyWithState
52 public class _XPropertyWithState
extends MultiMethodTest
{
57 public XPropertyWithState oObj
;
61 * Test calls the method.
62 * Test has ok status if no
63 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
66 public void _getDefaultAsProperty() {
69 XInterface defaultState
= (XInterface
) oObj
.getDefaultAsProperty();
71 } catch (com
.sun
.star
.lang
.WrappedTargetException e
){
72 e
.printStackTrace(log
);
73 throw new StatusException(Status
.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
76 tRes
.tested("getDefaultAsProperty()", true);
80 * Test is ok if <CODE>getStateAsProperty()</CODE> returns
81 * as <CODE>PropertyState</CODE> which is not <CODE>null</CODE>
83 public void _getStateAsProperty() {
87 PropertyState propState
= oObj
.getStateAsProperty();
89 if (propState
== null) {
90 log
.println("the returned PropertyState is null -> FALSE");
94 tRes
.tested("getStateAsProperty()", res
);
98 * Test calls the method.
99 * Test has ok status if no
100 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
103 public void _setToDefaultAsProperty() {
106 oObj
.setToDefaultAsProperty();
108 } catch (com
.sun
.star
.lang
.WrappedTargetException e
){
109 e
.printStackTrace(log
);
110 throw new StatusException(Status
.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
113 tRes
.tested("setToDefaultAsProperty()", true);