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 test
.codemaker
.javamaker
.java15
;
21 import com
.sun
.star
.lang
.XMultiComponentFactory
;
22 import com
.sun
.star
.uno
.DeploymentException
;
23 import com
.sun
.star
.uno
.XComponentContext
;
24 import complexlib
.ComplexTestCase
;
26 public final class Test
extends ComplexTestCase
{
27 public String
[] getTestMethodNames() {
29 "testPlainPolyStruct", "testBooleanPolyStruct", "testStruct",
33 public void testPlainPolyStruct() {
34 PolyStruct s
= new PolyStruct();
35 assure(s
.member1
== null);
36 assure(s
.member2
== 0);
37 s
= new PolyStruct("ABC", 5);
38 assure(s
.member1
.equals("ABC"));
39 assure(s
.member2
== 5);
42 public void testBooleanPolyStruct() {
43 PolyStruct
<Boolean
,Object
> s
= new PolyStruct
<Boolean
,Object
>();
44 assure(s
.member1
== null);
45 assure(s
.member2
== 0);
46 s
= new PolyStruct
<Boolean
,Object
>(true, 5);
47 assure(s
.member1
== true);
48 assure(s
.member2
== 5);
51 public void testStruct() {
52 Struct s
= new Struct();
53 assure(s
.member
.member1
== null);
54 assure(s
.member
.member2
== 0);
56 new PolyStruct
<PolyStruct
<boolean[], Object
>, Integer
>(
57 new PolyStruct
<boolean[], Object
>(new boolean[] { true }, 3),
59 assure(s
.member
.member1
.member1
.length
== 1);
60 assure(s
.member
.member1
.member1
[0] == true);
61 assure(s
.member
.member1
.member2
== 3);
62 assure(s
.member
.member2
== 4);
65 public void testService() {
66 XComponentContext context
= new XComponentContext() {
67 public Object
getValueByName(String name
) {
71 public XMultiComponentFactory
getServiceManager() {
72 throw new DeploymentException();
76 Service
.create(context
);
78 } catch (DeploymentException e
) {}
81 context
, false, (byte) 1, (short) 2, Integer
.valueOf(4));
83 } catch (DeploymentException e
) {}
86 private static final class Ifc
implements XIfc
{
87 public void f1(PolyStruct
<Integer
, Integer
> arg
) {}
89 public void f2(PolyStruct
<Object
, Object
> arg
) {}