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 .
21 import com
.sun
.star
.beans
.PropertyState
;
22 import lib
.MultiMethodTest
;
24 import com
.sun
.star
.beans
.XPropertyWithState
;
26 import lib
.StatusException
;
29 * Testing <code>com.sun.star.beans.XPropertyWithState</code>
32 * <li><code> getDefaultAsProperty()</code></li>
33 * <li><code> getStateAsProperty()</code></li>
34 * <li><code> setToDefaultAsProperty()</code></li>
36 * @see com.sun.star.beans.XPropertyWithState
39 public class _XPropertyWithState
extends MultiMethodTest
{
44 public XPropertyWithState oObj
;
48 * Test calls the method.
49 * Test has ok status if no
50 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
53 public void _getDefaultAsProperty() {
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);
66 * Test is ok if <CODE>getStateAsProperty()</CODE> returns
67 * as <CODE>PropertyState</CODE> which is not <CODE>null</CODE>
69 public void _getStateAsProperty() {
73 PropertyState propState
= oObj
.getStateAsProperty();
75 if (propState
== null) {
76 log
.println("the returned PropertyState is null -> FALSE");
80 tRes
.tested("getStateAsProperty()", res
);
84 * Test calls the method.
85 * Test has ok status if no
86 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
89 public void _setToDefaultAsProperty() {
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);