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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dynabeanmapdecoratortestcase.java

?? 這是一個有關(guān)common beanutils 的源碼
?? JAVA
字號:
/*
 * 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.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * <p>Test Case for the <code>DynaBeanMapDecorator</code> implementation class.</p>
 *
 * @author Niall Pemberton
 */
public class DynaBeanMapDecoratorTestCase extends TestCase {

    private static final DynaProperty stringProp = new DynaProperty("stringProp", String.class);
    private static final DynaProperty nullProp   = new DynaProperty("nullProp",   String.class);
    private static final DynaProperty intProp    = new DynaProperty("intProp",    Integer.class);
    private static final DynaProperty dateProp   = new DynaProperty("dateProp",   Date.class);
    private static final DynaProperty mapProp    = new DynaProperty("mapProp",    Map.class);
    private static final DynaProperty[] properties = new DynaProperty[] {
                      stringProp, nullProp, intProp, dateProp, mapProp};
    private static final DynaClass dynaClass = new BasicDynaClass("testDynaClass", BasicDynaBean.class, properties);

    private static String  stringVal = "somevalue";
    private static Integer intVal    = new Integer(5);
    private static Date    dateVal   = new Date();
    private Map     mapVal    = new HashMap();

    private Object[] values = new Object[] {stringVal, null, intVal, dateVal, mapVal};

    private BasicDynaBean dynaBean;
    private Map decoratedMap;
    private Map modifiableMap;
    private static final Map emptyMap = new DynaBeanMapDecorator(new BasicDynaBean(new BasicDynaClass()));

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

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

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

    /**
     * Run thus Test
     */
    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }

    /**
     * Return the tests included in this test suite.
     */
    public static Test suite() {
        return (new TestSuite(DynaBeanMapDecoratorTestCase.class));
    }

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

        mapVal.clear(); 
        mapVal.put("key1", "key1Value");
        mapVal.put("key2", "key2Value");

        // Initialize DynaBean and properties
        dynaBean = new BasicDynaBean(dynaClass);
        for (int i = 0; i < properties.length; i++) {
            dynaBean.set(properties[i].getName(), values[i]);
        }

        // Create decorated Maps
        decoratedMap  = new DynaBeanMapDecorator(dynaBean);
        modifiableMap = new DynaBeanMapDecorator(dynaBean, false);

    }

    /**
     * Tear down instance variables required by this test case.
     */
    public void tearDown() {
        dynaBean = null;
        decoratedMap = null;
        modifiableMap = null;
    }

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

    /**
     * Test isReadOnly() method
     */
    public void testIsReadOnly() {
        assertTrue("decoratedMap true",   ((DynaBeanMapDecorator)decoratedMap).isReadOnly());
        assertFalse("modifiableMap false", ((DynaBeanMapDecorator)modifiableMap).isReadOnly());
    }

    /**
     * Test clear() method
     */
    public void testClear() {
        try {
            decoratedMap.clear();
            fail("decoratedMap.clear()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }
        try {
            modifiableMap.clear();
            fail("modifiableMap.clear()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }
    }

    /**
     * Test containsKey() method
     */
    public void testContainsKey() {
        assertTrue("decoratedMap true",   decoratedMap.containsKey(stringProp.getName()));
        assertFalse("decoratedMap false", decoratedMap.containsKey("xyz"));
    }

    /**
     * Test containsValue() method
     */
    public void testContainsValue() {
        assertTrue("decoratedMap true",   decoratedMap.containsValue(stringVal));
        assertFalse("decoratedMap false", decoratedMap.containsValue("xyz"));
    }

    /**
     * Test entrySet() method
     */
    public void testEntrySet() {
        Set set = modifiableMap.entrySet();

        // Check the Set can't be modified
        checkUnmodifiable("entrySet()", set);

        assertEquals("entrySet size", properties.length, set.size());

        Iterator iterator = set.iterator();
        List namesList = new ArrayList();
        int i = 0;
        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry)iterator.next();
            String name  = (String)entry.getKey();
            namesList.add(name);
            Object expectValue = decoratedMap.get(name);
            assertEquals("entrySet("+i+") val", expectValue, entry.getValue());
            i++;
        }
        for (int j = 0; j < properties.length; j++) {
            String name = properties[j].getName();
            assertTrue("Check property[" + j + "]", namesList.contains(name));
        }
    }

    /**
     * Test get() method
     */
    public void testGet() {

        // valid property name
        assertEquals("decoratedMap valid", stringVal, decoratedMap.get(stringProp.getName()));

        // invalid property name
        try {
            decoratedMap.get("xyz");
            fail("decoratedMap invalid");
        } catch(IllegalArgumentException ignore) {
            // expected result
        }
    }

    /**
     * Test isEmpty() method
     */
    public void testIsEmpty() {
        assertTrue("Empty",      emptyMap.isEmpty());
        assertFalse("Not Empty", decoratedMap.isEmpty());
    }

    /**
     * Test keySet() method
     */
    public void testKeySet() {
        Set set = modifiableMap.keySet();

        // Check the Set can't be modified
        checkUnmodifiable("keySet()", set);

        assertEquals("keySet size", properties.length, set.size());

        for (int i = 0; i < properties.length; i++) {
            String name = properties[i].getName();
            assertTrue("Check property[" + i + "]", set.contains(name));
        }
    }

    /**
     * Test put() method
     */
    public void testPut() {

        String newValue = "ABC";

        // Test read only
        try {
            decoratedMap.put(stringProp.getName(), newValue);
            fail("Not read only");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Test Writable
        assertEquals("modifiableMap put", stringVal, modifiableMap.put(stringProp.getName(), newValue));
        assertEquals("dynaBean get", newValue, dynaBean.get(stringProp.getName()));
        assertEquals("modifiableMap get", newValue, modifiableMap.get(stringProp.getName()));
    }

    /**
     * Test putAll() method
     */
    public void testPutAll() {

        String newValue = "ABC";
        Map newMap = new HashMap();
        newMap.put(stringProp.getName(), newValue);

        // Test read only
        try {
            decoratedMap.putAll(newMap);
            fail("Not read only");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Test Writable
        assertEquals("before putAll", stringVal, dynaBean.get(stringProp.getName()));
        modifiableMap.putAll(newMap);
        assertEquals("after putAll",  newValue,  dynaBean.get(stringProp.getName()));
    }

    /**
     * Test remove() method
     */
    public void testRemove() {
        try {
            decoratedMap.remove(stringProp.getName());
            fail("decoratedMap.remove()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }
        try {
            modifiableMap.remove(stringProp.getName());
            fail("modifiableMap.remove()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }
    }

    /**
     * Test size() method
     */
    public void testSize() {
        assertEquals("Empty", 0, emptyMap.size());
        assertEquals("Not Empty", properties.length, decoratedMap.size());
    }

    /**
     * Test values() method
     */
    public void testValues() {
        Collection collection = modifiableMap.values();

        // Check the Collection can't be modified
        checkUnmodifiable("values()", collection);

        assertEquals("values size", values.length, collection.size());

        // Collection should be ordered in same sequence as properties
        Iterator iterator = collection.iterator();
        int i = 0;
        while (iterator.hasNext()) {
            assertEquals("values("+i+")", values[i], iterator.next());
            i++;
        }
    }

    /**
     * Check that a Collection is not modifiable
     */
    private void checkUnmodifiable(String desc, Collection collection) {
        String testVal = "xyz";

        // Check can't add()
        try {
            collection.add(testVal);
            fail(desc + ".add()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't addAll()
        List list = new ArrayList(1);
        list.add(testVal);
        try {
            collection.addAll(list);
            fail(desc + ".addAll()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't clear()
        try {
            collection.clear();
            fail(desc + ".clear()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't remove()
        try {
            collection.remove("abc");
            fail(desc + ".remove()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't removeAll()
        try {
            collection.removeAll(list);
            fail(desc + ".removeAll()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't retainAll()
        try {
            collection.retainAll(list);
            fail(desc + ".retainAll()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产视频一区在线播放| 成人丝袜高跟foot| 欧美视频自拍偷拍| 亚洲精品一二三四区| 成人h动漫精品| 欧美极品另类videosde| 国产乱子伦视频一区二区三区| 欧美日韩一区久久| 伊人婷婷欧美激情| 美脚の诱脚舐め脚责91 | 欧美激情一区在线观看| 黄网站免费久久| 久久久99久久| 国产91精品精华液一区二区三区| 久久久三级国产网站| 国产精品系列在线观看| 欧美日本一区二区| 日韩影院在线观看| 欧美变态口味重另类| 午夜精品久久久久久久久久久 | 欧美大白屁股肥臀xxxxxx| 免费看黄色91| 久久久99精品免费观看不卡| 狠狠色丁香婷婷综合久久片| 国产亚洲一区二区在线观看| 色屁屁一区二区| 久久99久久久欧美国产| 亚洲欧洲日产国产综合网| 欧美日韩免费在线视频| 国产成人在线视频免费播放| 伊人性伊人情综合网| www久久精品| 欧美亚男人的天堂| 国产成人免费视频精品含羞草妖精| 一片黄亚洲嫩模| 日本一二三不卡| 日韩精品一区二区三区老鸭窝| aa级大片欧美| 国产在线精品一区二区三区不卡| 亚洲乱码精品一二三四区日韩在线 | 色就色 综合激情| 国产在线播放一区三区四| 一区二区在线免费观看| 精品成人a区在线观看| 欧美主播一区二区三区美女| 激情综合一区二区三区| 午夜精品爽啪视频| 亚洲人123区| 中文字幕欧美国产| 欧美精品一区二区三区在线 | 99麻豆久久久国产精品免费| 国产一区二区三区免费在线观看| 亚洲国产精品尤物yw在线观看| 国产亚洲1区2区3区| 欧美一级免费大片| 欧美亚洲一区二区三区四区| 成人av先锋影音| 国产成人午夜片在线观看高清观看| 日本vs亚洲vs韩国一区三区| 亚洲大尺度视频在线观看| 1024成人网| 中文字幕制服丝袜一区二区三区 | 日韩一区二区三区电影| 欧美日本国产视频| 色琪琪一区二区三区亚洲区| 不卡一区中文字幕| 成人午夜精品在线| 丁香一区二区三区| 丁香一区二区三区| 成人永久看片免费视频天堂| 国产成人丝袜美腿| 国产剧情在线观看一区二区| 狠狠狠色丁香婷婷综合激情| 美女任你摸久久| 韩日av一区二区| 极品瑜伽女神91| 国产一二精品视频| 国产成人精品网址| 91在线免费视频观看| 成人av在线资源| 一本高清dvd不卡在线观看| 99精品视频一区二区三区| 91片在线免费观看| 色94色欧美sute亚洲13| 欧美三级三级三级爽爽爽| 欧美人妇做爰xxxⅹ性高电影| 欧美福利视频一区| 日韩欧美国产综合在线一区二区三区| 日韩情涩欧美日韩视频| 久久久亚洲欧洲日产国码αv| 欧美激情中文字幕| 成人欧美一区二区三区视频网页 | 蜜臀av一区二区在线免费观看| 美女网站视频久久| 国产美女视频一区| 成人国产精品免费观看视频| 91在线视频在线| 欧美日韩免费高清一区色橹橹| 欧美日韩国产色站一区二区三区| 69堂亚洲精品首页| 久久亚洲一区二区三区四区| 亚洲婷婷在线视频| 亚洲电影一级片| 国产一区二区导航在线播放| 99久久国产免费看| 51精品视频一区二区三区| 久久久久久亚洲综合| 最新国产精品久久精品| 亚洲综合一区二区三区| 美女在线一区二区| 99精品视频在线观看| 欧美一区二区三区爱爱| 国产精品亲子伦对白| 中文字幕一区二区三区在线不卡| 国内成+人亚洲+欧美+综合在线| 欧美日韩免费高清一区色橹橹 | 日本高清不卡视频| 91九色最新地址| 久久久五月婷婷| 精品一区二区三区不卡| 欧美精品色一区二区三区| 国产精品久久久久aaaa| www.亚洲国产| 欧美www视频| 美女视频黄久久| 国产成人精品亚洲午夜麻豆| 欧美日韩视频专区在线播放| 久久亚洲一区二区三区明星换脸 | 大白屁股一区二区视频| 中文字幕av一区二区三区| 91国产免费观看| 国产一区二区福利视频| 亚洲国产精品一区二区久久| 自拍偷拍国产精品| 国产日本欧洲亚洲| 精品国内二区三区| 欧美日韩黄色一区二区| 色老汉av一区二区三区| 91亚洲永久精品| 蜜桃久久久久久久| 久久精品人人做人人综合| 成人一级视频在线观看| 一区二区三区久久| 久久婷婷久久一区二区三区| 国产不卡高清在线观看视频| 亚洲女女做受ⅹxx高潮| 欧美日本在线视频| 黄色日韩网站视频| 一区二区三区在线观看视频| 精品久久人人做人人爱| 高潮精品一区videoshd| 亚洲人123区| 亚洲一区二区在线免费看| 不卡av在线免费观看| 国产亚洲欧美激情| 精品一区二区三区免费观看| 欧美日韩一级片在线观看| 亚洲欧美成aⅴ人在线观看| 粉嫩13p一区二区三区| 国产女同互慰高潮91漫画| 精品一区二区三区免费播放| 日韩欧美一卡二卡| 久久99久久久欧美国产| 精品人在线二区三区| 精品中文av资源站在线观看| 欧美一区二区三区爱爱| 日本欧美在线观看| 欧美一区二区成人6969| 日韩av网站在线观看| 91精品国产综合久久精品app | 欧美无砖砖区免费| 一区二区三区欧美视频| 色婷婷久久99综合精品jk白丝| 亚洲精品伦理在线| 欧美日韩二区三区| 麻豆专区一区二区三区四区五区| 日韩欧美黄色影院| 国产一区二区在线观看免费 | 欧美大片在线观看一区二区| 美女视频黄a大片欧美| 久久综合精品国产一区二区三区| 卡一卡二国产精品| 久久精品无码一区二区三区| 国产suv精品一区二区6| 亚洲欧美韩国综合色| 欧美午夜精品久久久久久孕妇| 亚洲成人动漫精品| 欧美成人伊人久久综合网| 成人免费视频国产在线观看| 亚洲人快播电影网| 欧美军同video69gay| 蜜桃免费网站一区二区三区| 国产欧美日韩视频在线观看| 色综合天天综合| 日本欧美大码aⅴ在线播放| 欧美精品一区二区蜜臀亚洲| 成人黄色片在线观看| 亚洲国产综合91精品麻豆| 欧美电视剧免费全集观看| 99久久久国产精品|