Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / beans / _XExactName.java
blobab8f6f96572dc009c8de3da6eec83fb6fa25d6ca
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;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.beans.XExactName;
28 public class _XExactName extends MultiMethodTest {
29 protected String expectedName = "";
30 public XExactName oObj = null;
32 public void _getExactName() {
33 String nameFor = expectedName.toLowerCase();
35 log.println("Getting exact name for " + nameFor);
37 String getting = oObj.getExactName(nameFor);
39 boolean res = true;
41 if (getting == null) {
42 res = false;
43 } else {
44 res = getting.equals(expectedName);
47 if (!res) {
48 log.println("didn't get the expected Name:");
49 log.println("getting: " + getting);
50 log.println("Expected: " + expectedName);
53 nameFor = expectedName.toUpperCase();
55 log.println("Getting exact name for " + nameFor);
56 getting = oObj.getExactName(nameFor);
58 if (getting == null) {
59 res = false;
60 } else {
61 res &= getting.equals(expectedName);
64 if (!getting.equals(expectedName)) {
65 log.println("didn't get the expected Name:");
66 log.println("getting: " + getting);
67 log.println("Expected: " + expectedName);
70 tRes.tested("getExactName()", res);
73 /**
74 * Checking if the Object relation expectedName is given
75 * throw a StatusException if not.
77 @Override
78 protected void before() {
79 expectedName = (String) tEnv.getObjRelation("expectedName");
81 if (expectedName == null) {
82 throw new StatusException(Status.failed(
83 "Object relation expectedName is missing"));