xref: /trunk/main/ridljar/test/com/sun/star/uno/Any_Test.java (revision 3309286857f19787ae62bd793a98b5af4edd2ad3)
1a046d00fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3a046d00fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4a046d00fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5a046d00fSAndrew Rist  * distributed with this work for additional information
6a046d00fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7a046d00fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8a046d00fSAndrew Rist  * "License"); you may not use this file except in compliance
9a046d00fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11a046d00fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13a046d00fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14a046d00fSAndrew Rist  * software distributed under the License is distributed on an
15a046d00fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16a046d00fSAndrew Rist  * KIND, either express or implied.  See the License for the
17a046d00fSAndrew Rist  * specific language governing permissions and limitations
18a046d00fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20a046d00fSAndrew Rist  *************************************************************/
21a046d00fSAndrew Rist 
22a046d00fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package com.sun.star.uno;
25cdf0e10cSrcweir 
26*967b1ad8SDamjan Jovanovic import org.junit.Test;
27*967b1ad8SDamjan Jovanovic import static org.junit.Assert.*;
28cdf0e10cSrcweir 
29*967b1ad8SDamjan Jovanovic public final class Any_Test {
30*967b1ad8SDamjan Jovanovic     @Test
testAnyAny()31cdf0e10cSrcweir     public void testAnyAny() {
32cdf0e10cSrcweir         boolean caught = false;
33cdf0e10cSrcweir         try {
34cdf0e10cSrcweir             new Any(Type.ANY, null);
35cdf0e10cSrcweir         } catch (IllegalArgumentException e) {
36cdf0e10cSrcweir             caught = true;
37cdf0e10cSrcweir         }
38*967b1ad8SDamjan Jovanovic         assertTrue(caught);
39cdf0e10cSrcweir     }
40cdf0e10cSrcweir 
41*967b1ad8SDamjan Jovanovic     @Test
testComplete()42cdf0e10cSrcweir     public void testComplete() {
43*967b1ad8SDamjan Jovanovic         assertTrue(Any.complete(Any.VOID) == Any.VOID);
44*967b1ad8SDamjan Jovanovic         assertTrue(
45cdf0e10cSrcweir             Any.complete(new Integer(10)).equals(
46cdf0e10cSrcweir                 new Any(Type.LONG, new Integer(10))));
47*967b1ad8SDamjan Jovanovic         assertTrue(
48cdf0e10cSrcweir             Any.complete(null).equals(
49cdf0e10cSrcweir                 new Any(new Type(XInterface.class), null)));
50cdf0e10cSrcweir         XInterface x = new XInterface() {};
51*967b1ad8SDamjan Jovanovic         assertTrue(Any.complete(x).equals(new Any(new Type(XInterface.class), x)));
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir }
54