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