001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.jaxws.description.impl;
020:
021: import junit.framework.TestCase;
022: import org.apache.axis2.jaxws.description.ParameterDescription;
023:
024: import javax.xml.ws.Holder;
025: import java.lang.reflect.Method;
026: import java.util.List;
027:
028: /**
029: *
030: */
031: public class ParameterDescriptionImplTests extends TestCase {
032:
033: /*
034: * This is a TEMPORARY test. It is testing the construction of a
035: * ParameterDesc using a class (instead of a DBC). Using a class should
036: * be deprecated and only a DBC should be used in construction
037: */
038: public void test1() {
039: Method[] methods = TestInterface.class.getMethods();
040: Method method1 = methods[0];
041: ParameterDescription pdc1 = new ParameterDescriptionImpl(0,
042: method1.getParameterTypes()[0], method1
043: .getGenericParameterTypes()[0], method1
044: .getAnnotations(), null);
045: assertNotNull(pdc1);
046: assertEquals(List[].class, pdc1.getParameterActualType());
047:
048: }
049:
050: public void test2() {
051: Method[] methods = TestInterface.class.getMethods();
052: Method method2 = methods[1];
053: ParameterDescription pdc2 = new ParameterDescriptionImpl(0,
054: method2.getParameterTypes()[0], method2
055: .getGenericParameterTypes()[0], method2
056: .getAnnotations(), null);
057: assertNotNull(pdc2);
058: assertEquals(String[].class, pdc2.getParameterActualType());
059: }
060:
061: public void test3() {
062: Method[] methods = TestInterface.class.getMethods();
063: Method method3 = methods[2];
064: ParameterDescription pdc3 = new ParameterDescriptionImpl(0,
065: method3.getParameterTypes()[0], method3
066: .getGenericParameterTypes()[0], method3
067: .getAnnotations(), null);
068: assertNotNull(pdc3);
069: assertEquals(List[].class, pdc3.getParameterActualType());
070: }
071:
072: public void test4() {
073: Method[] methods = TestInterface.class.getMethods();
074: Method method4 = methods[3];
075: ParameterDescription pdc4 = new ParameterDescriptionImpl(0,
076: method4.getParameterTypes()[0], method4
077: .getGenericParameterTypes()[0], method4
078: .getAnnotations(), null);
079: assertNotNull(pdc4);
080: assertEquals(String[].class, pdc4.getParameterActualType());
081: }
082:
083: public void test5() {
084: Method[] methods = TestInterface.class.getMethods();
085: Method method5 = methods[4];
086: ParameterDescription pdc = new ParameterDescriptionImpl(0,
087: method5.getParameterTypes()[0], method5
088: .getGenericParameterTypes()[0], method5
089: .getAnnotations(), null);
090: assertNotNull(pdc);
091: assertEquals(List[].class, pdc.getParameterActualType());
092: }
093: }
094:
095: interface TestInterface {
096: String method1(Holder<List<String>[]> foo);
097:
098: String method2(Holder<String[]> foo);
099:
100: String method3(Holder<List<?>[]> foo);
101:
102: String method4(String[] foo);
103:
104: String method5(List<String>[] foo);
105: }
|