xref: /aoo42x/main/ure/source/uretest/Tester.java (revision 87e37ca8)
1*87e37ca8SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*87e37ca8SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*87e37ca8SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*87e37ca8SAndrew Rist  * distributed with this work for additional information
6*87e37ca8SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*87e37ca8SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*87e37ca8SAndrew Rist  * "License"); you may not use this file except in compliance
9*87e37ca8SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*87e37ca8SAndrew Rist  *
11*87e37ca8SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*87e37ca8SAndrew Rist  *
13*87e37ca8SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*87e37ca8SAndrew Rist  * software distributed under the License is distributed on an
15*87e37ca8SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87e37ca8SAndrew Rist  * KIND, either express or implied.  See the License for the
17*87e37ca8SAndrew Rist  * specific language governing permissions and limitations
18*87e37ca8SAndrew Rist  * under the License.
19*87e37ca8SAndrew Rist  *
20*87e37ca8SAndrew Rist  *************************************************************/
21*87e37ca8SAndrew Rist 
22*87e37ca8SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package test.java.tester;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
27cdf0e10cSrcweir import test.types.CppTest;
28cdf0e10cSrcweir import test.types.JavaTest;
29cdf0e10cSrcweir import test.types.TestException;
30cdf0e10cSrcweir import test.types.XTest;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir public final class Tester {
test(XComponentContext context)33cdf0e10cSrcweir     public static void test(XComponentContext context) {
34cdf0e10cSrcweir         testService(CppTest.create(context), CppTest.class.getName());
35cdf0e10cSrcweir         testService(JavaTest.create(context), JavaTest.class.getName());
36cdf0e10cSrcweir     }
37cdf0e10cSrcweir 
testService(XTest test, String name)38cdf0e10cSrcweir     private static void testService(XTest test, String name) {
39cdf0e10cSrcweir         boolean ok = false;
40cdf0e10cSrcweir         try {
41cdf0e10cSrcweir             test.throwException();
42cdf0e10cSrcweir         } catch (TestException e) {
43cdf0e10cSrcweir             ok = true;
44cdf0e10cSrcweir         }
45cdf0e10cSrcweir         if (!ok) {
46cdf0e10cSrcweir             throw new RuntimeException(name + ".throwException failed");
47cdf0e10cSrcweir         }
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir 
Tester()50cdf0e10cSrcweir     private Tester() {}
51cdf0e10cSrcweir }
52