亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? propertyutilstestcase.java

?? 這是一個有關common beanutils 的源碼
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 


package org.apache.commons.beanutils;


import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import org.apache.commons.beanutils.priv.PrivateBeanFactory;
import org.apache.commons.beanutils.priv.PrivateDirect;
import org.apache.commons.beanutils.priv.PublicSubBean;

import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;


/**
 * <p>Test Case for the PropertyUtils class.  The majority of these tests use
 * instances of the TestBean class, so be sure to update the tests if you
 * change the characteristics of that class.</p>
 *
 * <p>So far, this test case has tests for the following methods of the
 * <code>PropertyUtils</code> class:</p>
 * <ul>
 * <li>getIndexedProperty(Object,String)</li>
 * <li>getIndexedProperty(Object,String,int)</li>
 * <li>getMappedProperty(Object,String)</li>
 * <li>getMappedProperty(Object,String,String</li>
 * <li>getNestedProperty(Object,String)</li>
 * <li>getPropertyDescriptor(Object,String)</li>
 * <li>getPropertyDescriptors(Object)</li>
 * <li>getPropertyType(Object,String)</li>
 * <li>getSimpleProperty(Object,String)</li>
 * <li>setIndexedProperty(Object,String,Object)</li>
 * <li>setIndexedProperty(Object,String,String,Object)</li>
 * <li>setMappedProperty(Object,String,Object)</li>
 * <li>setMappedProperty(Object,String,String,Object)</li>
 * <li>setNestedProperty(Object,String,Object)</li>
 * <li>setSimpleProperty(Object,String,Object)</li>
 * </ul>
 *
 * @author Craig R. McClanahan
 * @author Jan Sorensen
 * @version $Revision: 687223 $ $Date: 2008-08-20 03:05:45 +0100 (Wed, 20 Aug 2008) $
 */

public class PropertyUtilsTestCase extends TestCase {


    // ---------------------------------------------------- Instance Variables


    /**
     * The fully qualified class name of our private directly
     * implemented interface.
     */
    private static final String PRIVATE_DIRECT_CLASS =
            "org.apache.commons.beanutils.priv.PrivateDirect";


    /**
     * The fully qualified class name of our private indirectly
     * implemented interface.
     */
    private static final String PRIVATE_INDIRECT_CLASS =
            "org.apache.commons.beanutils.priv.PrivateIndirect";


    /**
     * The fully qualified class name of our test bean class.
     */
    private static final String TEST_BEAN_CLASS =
            "org.apache.commons.beanutils.TestBean";


    /**
     * The basic test bean for each test.
     */
    protected TestBean bean = null;


    /**
     * The "package private subclass" test bean for each test.
     */
    protected TestBeanPackageSubclass beanPackageSubclass = null;


    /**
     * The test bean for private access tests.
     */
    protected PrivateDirect beanPrivate = null;


    /**
     * The test bean for private access tests of subclasses.
     */
    protected PrivateDirect beanPrivateSubclass = null;


    /**
     * The "public subclass" test bean for each test.
     */
    protected TestBeanPublicSubclass beanPublicSubclass = null;


    /**
     * The set of properties that should be described.
     */
    protected String describes[] =
    { "booleanProperty",
      "booleanSecond",
      "doubleProperty",
      "floatProperty",
      "intArray",
      //      "intIndexed",
      "intProperty",
      "listIndexed",
      "longProperty",
      //      "mappedObjects",
      //      "mappedProperty",
      //      "mappedIntProperty",
      "nested",
      "nullProperty",
      //      "readOnlyProperty",
      "shortProperty",
      "stringArray",
      //      "stringIndexed",
      "stringProperty"
    };


    /**
     * The set of property names we expect to have returned when calling
     * <code>getPropertyDescriptors()</code>.  You should update this list
     * when new properties are added to TestBean.
     */
    protected final static String[] properties = {
        "booleanProperty",
        "booleanSecond",
        "doubleProperty",
        "dupProperty",
        "floatProperty",
        "intArray",
        "intIndexed",
        "intProperty",
        "listIndexed",
        "longProperty",
        "nested",
        "nullProperty",
        "readOnlyProperty",
        "shortProperty",
        "stringArray",
        "stringIndexed",
        "stringProperty",
        "writeOnlyProperty",
    };


    // ---------------------------------------------------------- Constructors


    /**
     * Construct a new instance of this test case.
     *
     * @param name Name of the test case
     */
    public PropertyUtilsTestCase(String name) {

        super(name);

    }


    // -------------------------------------------------- Overall Test Methods


    /**
     * Set up instance variables required by this test case.
     */
    public void setUp() {

        bean = new TestBean();
        beanPackageSubclass = new TestBeanPackageSubclass();
        beanPrivate = PrivateBeanFactory.create();
        beanPrivateSubclass = PrivateBeanFactory.createSubclass();
        beanPublicSubclass = new TestBeanPublicSubclass();

        DynaProperty[] properties = new DynaProperty[] {
                new DynaProperty("stringProperty", String.class),
                new DynaProperty("nestedBean", TestBean.class),
                new DynaProperty("nullDynaBean", DynaBean.class)
                };
        BasicDynaClass dynaClass = new BasicDynaClass("nestedDynaBean", BasicDynaBean.class, properties);
        BasicDynaBean nestedDynaBean = new BasicDynaBean(dynaClass);
        nestedDynaBean.set("nestedBean", bean);
        bean.setNestedDynaBean(nestedDynaBean);
    }


    /**
     * Return the tests included in this test suite.
     */
    public static Test suite() {

        return (new TestSuite(PropertyUtilsTestCase.class));

    }


    /**
     * Tear down instance variables required by this test case.
     */
    public void tearDown() {

        bean = null;
        beanPackageSubclass = null;
        beanPrivate = null;
        beanPrivateSubclass = null;
        beanPublicSubclass = null;

    }



    // ------------------------------------------------ Individual Test Methods


    /**
     * Test copyProperties() when the origin is a a <code>Map</code>.
     */
    public void testCopyPropertiesMap() {

        Map map = new HashMap();
        map.put("booleanProperty", Boolean.FALSE);
        map.put("doubleProperty", new Double(333.0));
        map.put("dupProperty", new String[] { "New 0", "New 1", "New 2" });
        map.put("floatProperty", new Float((float) 222.0));
        map.put("intArray", new int[] { 0, 100, 200 });
        map.put("intProperty", new Integer(111));
        map.put("longProperty", new Long(444));
        map.put("shortProperty", new Short((short) 555));
        map.put("stringProperty", "New String Property");

        try {
            PropertyUtils.copyProperties(bean, map);
        } catch (Throwable t) {
            fail("Threw " + t.toString());
        }

        // Scalar properties
        assertEquals("booleanProperty", false,
                     bean.getBooleanProperty());
        assertEquals("doubleProperty", 333.0,
                     bean.getDoubleProperty(), 0.005);
        assertEquals("floatProperty", (float) 222.0,
                     bean.getFloatProperty(), (float) 0.005);
        assertEquals("intProperty", 111,
                     bean.getIntProperty());
        assertEquals("longProperty", 444,
                     bean.getLongProperty());
        assertEquals("shortProperty", (short) 555,
                     bean.getShortProperty());
        assertEquals("stringProperty", "New String Property",
                     bean.getStringProperty());
                     
        // Indexed Properties
        String dupProperty[] = bean.getDupProperty();
        assertNotNull("dupProperty present", dupProperty);
        assertEquals("dupProperty length", 3, dupProperty.length);
        assertEquals("dupProperty[0]", "New 0", dupProperty[0]);
        assertEquals("dupProperty[1]", "New 1", dupProperty[1]);
        assertEquals("dupProperty[2]", "New 2", dupProperty[2]);
        int intArray[] = bean.getIntArray();
        assertNotNull("intArray present", intArray);
        assertEquals("intArray length", 3, intArray.length);
        assertEquals("intArray[0]", 0, intArray[0]);
        assertEquals("intArray[1]", 100, intArray[1]);
        assertEquals("intArray[2]", 200, intArray[2]);

    }


    /**
     * Test the describe() method.
     */
    public void testDescribe() {

        Map map = null;
        try {
            map = PropertyUtils.describe(bean);
        } catch (Exception e) {
            fail("Threw exception " + e);
        }

        // Verify existence of all the properties that should be present
        for (int i = 0; i < describes.length; i++) {
            assertTrue("Property '" + describes[i] + "' is present",
                       map.containsKey(describes[i]));
        }
        assertTrue("Property 'writeOnlyProperty' is not present",
                   !map.containsKey("writeOnlyProperty"));

        // Verify the values of scalar properties
        assertEquals("Value of 'booleanProperty'",
                     Boolean.TRUE, map.get("booleanProperty"));
        assertEquals("Value of 'doubleProperty'",
                     new Double(321.0), map.get("doubleProperty"));
        assertEquals("Value of 'floatProperty'",
                     new Float((float) 123.0), map.get("floatProperty"));
        assertEquals("Value of 'intProperty'",
                     new Integer(123), map.get("intProperty"));
        assertEquals("Value of 'longProperty'",
                     new Long(321), map.get("longProperty"));
        assertEquals("Value of 'shortProperty'",
                     new Short((short) 987), map.get("shortProperty"));
        assertEquals("Value of 'stringProperty'",
                     "This is a string",
                     (String) map.get("stringProperty"));

    }


    /**
     * Corner cases on getPropertyDescriptor invalid arguments.
     */
    public void testGetDescriptorArguments() {

        try {
            PropertyUtils.getPropertyDescriptor(null, "stringProperty");
            fail("Should throw IllegalArgumentException 1");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人sese在线| 人人精品人人爱| 一区二区高清在线| 青青草97国产精品免费观看| 99久久久久久| 欧美精品一区二区三区高清aⅴ | 天堂午夜影视日韩欧美一区二区| 国产精品一区免费在线观看| 欧美日韩视频一区二区| 亚洲欧美日韩综合aⅴ视频| 精品在线一区二区| 欧美一区三区二区| 一区二区三区欧美日韩| 成人黄页在线观看| 日韩精品中午字幕| 蜜臀av性久久久久蜜臀aⅴ四虎| 在线播放国产精品二区一二区四区| 麻豆成人免费电影| 成人app在线| 一区二区欧美精品| 中文字幕在线不卡一区二区三区| 色综合久久天天| 狠狠色狠狠色合久久伊人| 亚洲影院在线观看| 欧美mv和日韩mv的网站| 7878成人国产在线观看| 欧美视频一区在线观看| 欧洲一区二区三区免费视频| 国产精品久久久久久久久晋中 | 精品国产一区二区三区四区四| 亚洲综合色网站| 欧美曰成人黄网| 亚洲最大的成人av| 欧美系列在线观看| 性欧美疯狂xxxxbbbb| 精品视频1区2区| 日本中文一区二区三区| 在线综合视频播放| 久久狠狠亚洲综合| 久久综合99re88久久爱| 国产成人综合网| 日韩一区日韩二区| 欧美视频在线观看一区二区| 日韩精品成人一区二区在线| 日韩欧美中文字幕一区| 国产精品自拍三区| 国产精品久久久久久久裸模 | 成人av网址在线观看| 国产精品家庭影院| 91黄视频在线| 日本va欧美va精品| 中文字幕av一区二区三区| 91麻豆免费观看| 日本在线不卡视频| 国产欧美日韩一区二区三区在线观看| 福利一区在线观看| 一区二区三区在线视频观看58| 欧美日韩激情一区| 国产在线视频一区二区三区| 国产精品国模大尺度视频| 欧美日韩一区中文字幕| 韩日av一区二区| 一区二区三区高清| 日韩欧美精品在线视频| 北条麻妃一区二区三区| 午夜婷婷国产麻豆精品| 国产视频不卡一区| 欧美日韩一区二区欧美激情| 激情综合网av| 一区二区免费视频| 亚洲一区二区三区四区五区中文| 亚洲在线中文字幕| 日韩欧美一级二级三级| 美女视频黄 久久| 色综合色狠狠天天综合色| 久久亚洲一级片| 日韩激情av在线| 色国产综合视频| 国产精品国产三级国产普通话三级 | 91香蕉视频mp4| 午夜久久久久久| 欧美激情一二三区| 制服丝袜在线91| 99re这里只有精品首页| 男人的天堂久久精品| 亚洲男同性视频| 久久九九全国免费| 欧美一区二区三区的| 色综合久久久久综合体| 韩国三级电影一区二区| 亚洲第一激情av| 亚洲色图第一区| 国产视频一区二区在线| 日韩女优毛片在线| 欧美综合天天夜夜久久| 99久久亚洲一区二区三区青草 | 国产精品欧美经典| 精品成人佐山爱一区二区| 欧美精三区欧美精三区| 欧洲视频一区二区| 91论坛在线播放| 91丨porny丨首页| k8久久久一区二区三区| 国产精品一区二区久久精品爱涩| 男男成人高潮片免费网站| 亚洲国产综合91精品麻豆| 亚洲老司机在线| 亚洲免费大片在线观看| 亚洲精品乱码久久久久久黑人| 国产精品成人网| 国产精品久久久久久亚洲毛片| 久久精品夜色噜噜亚洲aⅴ| 久久青草欧美一区二区三区| 精品日韩欧美在线| 精品乱人伦一区二区三区| 日韩视频一区二区三区 | 欧美日韩亚洲丝袜制服| 欧美性大战久久久久久久蜜臀| 欧美亚洲国产一卡| 欧美蜜桃一区二区三区| 7777精品伊人久久久大香线蕉超级流畅 | 欧美三级资源在线| 国产在线视频精品一区| 免费精品视频最新在线| 一区二区三区日韩精品视频| 亚洲欧洲韩国日本视频| 国产午夜亚洲精品理论片色戒| 精品久久久久一区二区国产| 亚洲国产成人午夜在线一区| 国产精一区二区三区| 亚洲人成人一区二区在线观看| 天天综合日日夜夜精品| 亚洲午夜在线视频| 欧美aaa在线| 亚洲国产精品一区二区尤物区| 综合久久一区二区三区| 天天色综合成人网| 亚洲电影在线播放| 午夜精品久久久久久久99水蜜桃 | 国产成人精品亚洲日本在线桃色| 国产一区不卡视频| 成人久久久精品乱码一区二区三区 | 在线成人午夜影院| 欧美电影免费观看高清完整版| 国产亚洲欧美激情| 一区在线中文字幕| 日本午夜一区二区| 国产在线不卡视频| 在线视频一区二区三| 日韩视频中午一区| 亚洲日本免费电影| 久久国产综合精品| 91丨porny丨最新| 精品国产91亚洲一区二区三区婷婷 | 久久久精品免费免费| 亚洲午夜视频在线| 国产高清精品网站| 欧美绝品在线观看成人午夜影视| 2023国产精品自拍| 亚洲国产精品一区二区尤物区| 国产高清精品久久久久| 欧美另类videos死尸| 中文字幕在线播放不卡一区| 青青草国产精品97视觉盛宴| 91在线精品一区二区三区| 欧美变态口味重另类| 亚洲综合在线电影| 久久www免费人成看片高清| 国产999精品久久久久久绿帽| 亚洲国产三级在线| 色噜噜狠狠色综合欧洲selulu| 欧美一级二级三级乱码| 亚洲成人激情综合网| 91丨porny丨蝌蚪视频| 亚洲国产精品激情在线观看| 国产精品自产自拍| 精品久久久久久久久久久久包黑料| 亚洲免费在线观看| 欧美专区在线观看一区| 久久99在线观看| 亚洲综合色婷婷| 另类成人小视频在线| 欧美性videosxxxxx| 一卡二卡三卡日韩欧美| av在线综合网| 中文字幕一区二区三区av| 国产成人久久精品77777最新版本| 欧美浪妇xxxx高跟鞋交| 亚洲午夜私人影院| 伊人色综合久久天天| 欧美日韩国产三级| 欧美在线影院一区二区| 视频一区二区三区中文字幕| 中文字幕不卡在线| 午夜婷婷国产麻豆精品| 色琪琪一区二区三区亚洲区| 欧美日韩1区2区| 国产一区二区三区日韩| 亚洲综合成人网| 欧美精品一区二区三区蜜桃|