1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package ifc.beans; 29 30 import lib.MultiMethodTest; 31 import lib.Status; 32 import lib.StatusException; 33 34 import com.sun.star.beans.XExactName; 35 36 37 public class _XExactName extends MultiMethodTest { 38 protected String expectedName = ""; 39 public XExactName oObj = null; 40 41 public void _getExactName() { 42 String nameFor = expectedName.toLowerCase(); 43 44 log.println("Getting exact name for " + nameFor); 45 46 String getting = oObj.getExactName(nameFor); 47 48 boolean res = true; 49 50 if (getting == null) { 51 res = false; 52 } else { 53 res = getting.equals(expectedName); 54 } 55 56 if (!res) { 57 log.println("didn't get the expected Name:"); 58 log.println("getting: " + getting); 59 log.println("Expected: " + expectedName); 60 } 61 62 nameFor = expectedName.toUpperCase(); 63 64 log.println("Getting exact name for " + nameFor); 65 getting = oObj.getExactName(nameFor); 66 67 if (getting == null) { 68 res = false; 69 } else { 70 res &= getting.equals(expectedName); 71 } 72 73 if (!getting.equals(expectedName)) { 74 log.println("didn't get the expected Name:"); 75 log.println("getting: " + getting); 76 log.println("Expected: " + expectedName); 77 } 78 79 tRes.tested("getExactName()", res); 80 } 81 82 /** 83 * Checking if the Object relation expectedName is given 84 * throw a StatusException if not. 85 */ 86 protected void before() { 87 expectedName = (String) tEnv.getObjRelation("expectedName"); 88 89 if (expectedName == null) { 90 throw new StatusException(Status.failed( 91 "Object relation expectedName is missing")); 92 } 93 } 94 }