1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Test.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package test
.codemaker
.javamaker
.java15
;
33 import com
.sun
.star
.lang
.XMultiComponentFactory
;
34 import com
.sun
.star
.uno
.DeploymentException
;
35 import com
.sun
.star
.uno
.XComponentContext
;
36 import complexlib
.ComplexTestCase
;
38 public final class Test
extends ComplexTestCase
{
39 public String
[] getTestMethodNames() {
41 "testPlainPolyStruct", "testBooleanPolyStruct", "testStruct",
45 public void testPlainPolyStruct() {
46 PolyStruct s
= new PolyStruct();
47 assure(s
.member1
== null);
48 assure(s
.member2
== 0);
49 s
= new PolyStruct("ABC", 5);
50 assure(s
.member1
.equals("ABC"));
51 assure(s
.member2
== 5);
54 public void testBooleanPolyStruct() {
55 PolyStruct
<Boolean
,Object
> s
= new PolyStruct
<Boolean
,Object
>();
56 assure(s
.member1
== null);
57 assure(s
.member2
== 0);
58 s
= new PolyStruct
<Boolean
,Object
>(true, 5);
59 assure(s
.member1
== true);
60 assure(s
.member2
== 5);
63 public void testStruct() {
64 Struct s
= new Struct();
65 assure(s
.member
.member1
== null);
66 assure(s
.member
.member2
== 0);
68 new PolyStruct
<PolyStruct
<boolean[], Object
>, Integer
>(
69 new PolyStruct
<boolean[], Object
>(new boolean[] { true }, 3),
71 assure(s
.member
.member1
.member1
.length
== 1);
72 assure(s
.member
.member1
.member1
[0] == true);
73 assure(s
.member
.member1
.member2
== 3);
74 assure(s
.member
.member2
== 4);
77 public void testService() {
78 XComponentContext context
= new XComponentContext() {
79 public Object
getValueByName(String name
) {
83 public XMultiComponentFactory
getServiceManager() {
88 Service
.create(context
);
90 } catch (DeploymentException e
) {}
93 context
, false, (byte) 1, (short) 2, Integer
.valueOf(4));
95 } catch (DeploymentException e
) {}
98 private static final class Ifc
implements XIfc
{
99 public void f1(PolyStruct
<Integer
, Integer
> arg
) {}
101 public void f2(PolyStruct
<Object
, Object
> arg
) {}