jp.terasoluna.fw.util.GenericPropertyUtilTest.java Source code

Java tutorial

Introduction

Here is the source code for jp.terasoluna.fw.util.GenericPropertyUtilTest.java

Source

/*
 * Copyright (c) 2007 NTT DATA Corporation
 *
 * Licensed 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 jp.terasoluna.fw.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.PropertyUtilsBean;
import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
import static uk.org.lidalia.slf4jtest.LoggingEvent.trace;
import static java.util.Arrays.asList;
import static org.hamcrest.core.Is.*;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import org.springframework.test.util.ReflectionTestUtils;

/**
 * {@link jp.terasoluna.fw.GenericPropertyUtil} ?
 * <p>
 * <h4>???</h4> <code>JavaBean</code>??<code>Generics</code>????
 * <p>
 * @see jp.terasoluna.fw.util.GenericPropertyUtil
 */
public class GenericPropertyUtilTest {

    private TestLogger logger = TestLoggerFactory.getTestLogger(GenericPropertyUtil.class);

    /**
     * PropertyUtilsBean
     */
    private PropertyUtilsBean defaultPropertyUtilsBean = null;

    /**
     * ???
     */
    @Before
    public void setUp() {
        BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
        defaultPropertyUtilsBean = beanUtilsBean.getPropertyUtils();
    }

    /**
     * ??
     * @throws Exception ?????
     */
    @After
    public void tearDown() throws Exception {
        BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
        ReflectionTestUtils.setField(beanUtilsBean, "propertyUtilsBean", defaultPropertyUtilsBean);
        logger.clear();
    }

    /**
     * testResolveCollectionType01()
     * <br><br>
     * ()<br>
     * G <br>
     * <br>
     * () bean:null<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * bean?null???IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType01() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(null, null);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType02() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object<br>
     * () name:null<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * name?null???IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType02() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(new Object(), null);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType03() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object?Class<br>
     * () name:""<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * name????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType03() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(new Object(), "");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType04() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object?Class<br>
     * () name:"   "<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * name????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType04() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(new Object(), "   ");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType05() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:List<String> list0???????getter????<br>
     * () name:"list0"<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * ???????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType05() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "list0");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType06() <br>
     * <br>
     * () <br>
     * E <br>
     * <br>
     * () bean:List<String> list1?????getter??<br>
     * () name:"list1"<br>
     * <br>
     * () Class:String.class<br>
     * <br>
     * ?????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType06() throws Exception {

        // 
        Class<?> actual = GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "list1");

        // 
        assertEquals(String.class, actual);
    }

    /**
     * testResolveCollectionType07() <br>
     * <br>
     * () <br>
     * E <br>
     * <br>
     * () bean:List<Map<String, Object>> list2?????getter??<br>
     * () name:"list2"<br>
     * <br>
     * () Class:Map.class<br>
     * <br>
     * ?????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType07() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "list2");

        // 
        assertEquals(Map.class, actual);
    }

    /**
     * testResolveCollectionType08() <br>
     * <br>
     * () <br>
     * E <br>
     * <br>
     * () bean:List<String[]> list3?????getter??<br>
     * () name:"list3"<br>
     * <br>
     * () Class:String[].class<br>
     * <br>
     * ?????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType08() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "list3");

        // 
        assertEquals(String[].class, actual);
    }

    /**
     * testResolveCollectionType09() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:int integer?????getter??<br>
     * () name:"integer"<br>
     * <br>
     * () :IllegalStateException<br>
     * <br>
     * ??????IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType09() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "integer");
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType10() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object object?????getter??<br>
     * () name:"object"<br>
     * <br>
     * () :IllegalStateException<br>
     * <br>
     * ???Collection????IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType10() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "object");
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveCollectionType11() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:List<? extends String> list5????getter??<br>
     * () name:"list5"<br>
     * <br>
     * () Class:Object.class<br>
     * <br>
     * ????Object??????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveCollectionType11() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveCollectionType(new GenericPropertyUtil_Stub01(), "list5");
        // 
        assertEquals(Object.class, actual);
    }

    /**
     * testResolveTypeObjectStringClassint01() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:null<br>
     * () index:0<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'bean' ("<br>
     * + Object.class.getName() + " is null"<br>
     * <br>
     * bean?null???IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint01() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(null, (String) null, null, 0);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'bean' (" + Object.class.getName() + " is null";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint02() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object<br>
     * () name:null<br>
     * () index:0<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'name' ("<br>
     * + String.class.getName() + " is empty"<br>
     * <br>
     * name?null???IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint02() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new Object(), (String) null, null, 0);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'name' (" + String.class.getName() + " is empty";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint03() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object<br>
     * () name:""<br>
     * () index:0<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'name' ("<br>
     * + String.class.getName() + " is empty"<br>
     * <br>
     * name????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint03() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new Object(), "", null, 0);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'name' (" + String.class.getName() + " is empty";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint04() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Object<br>
     * () name:"   "<br>
     * () index:0<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'name' ("<br>
     * + String.class.getName() + " is empty"<br>
     * <br>
     * name????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint04() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new Object(), "   ", null, 0);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'name' (" + String.class.getName() + " is empty";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint05() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Map<String, Object> map0???????getter????<br>
     * () name:"map0"<br>
     * () genericClass:Map.class<br>
     * () index:0<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * ???????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint05() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map0", Map.class, 0);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint06() <br>
     * <br>
     * () <br>
     * G <br>
     * <br>
     * () bean:Map<String, Object> map1????getter??<br>
     * () name:"map1"<br>
     * () genericClass:Map.class<br>
     * () index:-1<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * index??????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint06() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map1", Map.class, -1);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint07() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () bean:Map<String, Object> map1????getter??<br>
     * () name:"map1"<br>
     * () genericClass:Map.class<br>
     * () index:0<br>
     * <br>
     * () Class:String.class<br>
     * <br>
     * index??????????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint07() throws Exception {

        // 
        Class<?> actual = GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map1", Map.class, 0);

        // 
        assertEquals(String.class, actual);
    }

    /**
     * testResolveTypeObjectStringClassint08() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () bean:Map<String, Object> map1????getter??<br>
     * () name:"map1"<br>
     * () genericClass:Map.class<br>
     * () index:1<br>
     * <br>
     * () Class:Object.class<br>
     * <br>
     * index??????????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint08() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map1", Map.class, 0);

        // 
        assertEquals(String.class, actual);
    }

    /**
     * testResolveTypeObjectStringClassint09() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:Map<String, Object> map1????getter??<br>
     * () name:"map1"<br>
     * () genericClass:Map.class<br>
     * () index:2<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * index??????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint09() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map1", Map.class, 2);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint10() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:Map<String, Object> map1????getter??<br>
     * () name:"map1"<br>
     * () genericClass:null<br>
     * () index:1<br>
     * <br>
     * () :IllegalArgumentException<br>
     * <br>
     * genericClass?null????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint10() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map1", null, 1);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint11() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () bean:Map<String[], List<String>> map2????getter??<br>
     * () name:"map2"<br>
     * () genericClass:Map.class<br>
     * () index:0<br>
     * <br>
     * () Class:String[].class<br>
     * <br>
     * ?????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint11() throws Exception {

        // 
        Class<?> actual = GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map2", Map.class, 0);

        // 
        assertEquals(String[].class, actual);
    }

    /**
     * testResolveTypeObjectStringClassint12() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () bean:Map<String[], List<String>> map2????getter??<br>
     * () name:"map2"<br>
     * () genericClass:Map.class<br>
     * () index:1<br>
     * <br>
     * () Class:List.class<br>
     * <br>
     * ?????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint12() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map2", Map.class, 1);

        // 
        assertEquals(List.class, actual);
    }

    /**
     * testResolveTypeObjectStringClassint13() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:Map<String[], List<String>> map2????getter??<br>
     * () name:"map2"<br>
     * () genericClass:String.class<br>
     * () index:1<br>
     * <br>
     * () :IllegalStateException<br>
     * <br>
     * genericClass????????? IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint13() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map2", String.class, 1);
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint14() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:?int integer????getter??<br>
     * () name:"integer"<br>
     * () genericClass:int.class<br>
     * () index:1<br>
     * <br>
     * () :IllegalStateException<br>
     * "No parameterizedType was detected."<br>
     * <br>
     * ?????? IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint14() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "integer", int.class, 1);
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            assertEquals("No parameterizedType was detected.", e.getMessage());
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint15() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:?Object object????getter??<br>
     * () name:"object"<br>
     * () genericClass:Object.class<br>
     * () index:1<br>
     * <br>
     * () :IllegalStateException<br>
     * "No parameterizedType was detected."<br>
     * <br>
     * ?????? IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint15() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "object", Object.class, 1);
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            assertEquals("No parameterizedType was detected.", e.getMessage());
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeObjectStringClassint16() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () bean:Map<?, ?> map3????getter??<br>
     * () name:"map3"<br>
     * () genericClass:Map.class<br>
     * () index:1<br>
     * <br>
     * () Class:Object.class<br>
     * <br>
     * ????Object??????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeObjectStringClassint16() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveType(new GenericPropertyUtil_Stub01(), "map3", Map.class, 0);

        // 
        assertEquals(Object.class, actual);
    }

    /**
     * testGetMethod01() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:String string?getter, setter????<br>
     * () name:"string"<br>
     * <br>
     * () :IllegalArgumentException<br>
     * bean??? + " has no getter for property string"<br>
     * <br>
     * ???????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testGetMethod01() throws Exception {
        try {
            // 
            GenericPropertyUtil.getMethod(new GenericPropertyUtil_Stub02(), "string");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = GenericPropertyUtil_Stub02.class.getName() + " has no getter for property string";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testGetMethod02() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:String string1???????getter????<br>
     * () name:"string1"<br>
     * <br>
     * () :IllegalArgumentException<br>
     * bean??? + " has no getter for property string1"<br>
     * <br>
     * ???????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testGetMethod02() throws Exception {
        try {
            // 
            GenericPropertyUtil.getMethod(new GenericPropertyUtil_Stub02(), "string1");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = GenericPropertyUtil_Stub02.class.getName() + " has no getter for property string1";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testGetMethod03() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () bean:String string2????getter??<br>
     * () name:"string2"<br>
     * <br>
     * () Method:bean?getString2<br>
     * <br>
     * ???????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testGetMethod03() throws Exception {
        // 
        Method actual = GenericPropertyUtil.getMethod(new GenericPropertyUtil_Stub02(), "string2");

        // 
        Method expected = GenericPropertyUtil_Stub02.class.getDeclaredMethod("getString2", new Class[0]);
        assertEquals(expected, actual);
    }

    /**
     * testGetMethod04() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:bean1???????getter????<br>
     * () name:"bean1.string"<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Failed to detect getter for "<br>
     * + bean??? + "#bean1.string"<br>
     * ??NoSuchMethodException<br>
     * <br>
     * PropertyUtils#getPropertyDescriptor?NoSuchMethodException???? <br>
     * @throws Exception ?????
     */
    @Test
    public void testGetMethod04() throws Exception {
        try {
            // 
            GenericPropertyUtil.getMethod(new GenericPropertyUtil_Stub02(), "bean1.string");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Failed to detect getter for " + GenericPropertyUtil_Stub02.class.getName()
                    + "#bean1.string";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
            assertTrue(e.getCause() instanceof NoSuchMethodException);
        }
    }

    /**
     * testGetMethod05() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:bean2????getter??<br>
     * (getter??RuntimeException??)<br>
     * () name:"bean2.string"<br>
     * () PropertyUtils#getPropertyDescriptor??: InvocationTargetException JavaBean?getter?RuntimeException<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Failed to detect getter for "<br>
     * + bean??? + "#bean2.string"<br>
     * ??InvocationTargetException<br>
     * <br>
     * PropertyUtils#getPropertyDescriptor?InvocationTargetException???? <br>
     * @throws Exception ?????
     */
    @Test
    public void testGetMethod05() throws Exception {
        try {
            // 
            GenericPropertyUtil.getMethod(new GenericPropertyUtil_Stub02(), "bean2.string");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Failed to detect getter for " + GenericPropertyUtil_Stub02.class.getName()
                    + "#bean2.string";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
            assertTrue(e.getCause() instanceof InvocationTargetException);
        }
    }

    /**
     * testGetMethod06() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () bean:String string2????getter??<br>
     * () name:"string2"<br>
     * () PropertyUtils#getPropertyDescriptor??: IllegalAccessException
     * PropertyUtilsBean??IllegalAccessException<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Failed to detect getter for "<br>
     * + bean??? + "#string2"<br>
     * ??IllegalAccessException<br>
     * <br>
     * PropertyUtils#getPropertyDescriptor?IllegalAccessException???? <br>
     * @throws Exception ?????
     */
    @Test
    public void testGetMethod06() throws Exception {
        // ??
        BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
        ReflectionTestUtils.setField(beanUtilsBean, "propertyUtilsBean",
                new GenericPropertyUtil_PropertyUtilsBeanStub01());
        try {

            // 
            GenericPropertyUtil.getMethod(new GenericPropertyUtil_Stub02(), "string2");
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Failed to detect getter for " + GenericPropertyUtil_Stub02.class.getName()
                    + "#string2";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
            assertTrue(e.getCause() instanceof IllegalAccessException);
        }
    }

    /**
     * testResolveTypeClassClassTypeint01() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () genericClass:null<br>
     * () index:0<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'genericsClass' ("<br>
     * + Class.class.getName() + ") is null"<br>
     * <br>
     * genericClass?null???IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint01() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType((Class<?>) null, (Class<?>) null, null, 0);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'genericsClass' (" + Class.class.getName() + ") is null";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeClassClassTypeint02() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:null<br>
     * () index:0<br>
     * <br>
     * () :IllegalStateException<br>
     * genericClass+ " is not assignable from " + clazz<br>
     * <br>
     * clazz?null???IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint02() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(List.class, (Class<?>) null, null, 0);
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            String message = List.class + " is not assignable from " + "null";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeClassClassTypeint03() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:Object.class<br>
     * () index:0<br>
     * <br>
     * () :IllegalStateException<br>
     * genericClass+ " is not assignable from " + clazz<br>
     * <br>
     * clazz?genericClass???????IllegalStateException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint03() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(List.class, Object.class, null, 0);
            // 
            fail("???????");
        } catch (IllegalStateException e) {
            String message = List.class + " is not assignable from " + Object.class;
            assertEquals(message, e.getMessage());
            assertEquals(IllegalStateException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeClassClassTypeint04() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:ArrayList(?String)<br>
     * () type:null<br>
     * () index:-1<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'index'(-1) is out of bounds of"<br>
     * + " generics parameters")<br>
     * <br>
     * index??????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint04() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(List.class, GenericPropertyUtil_ArrayListStub01.class, null, -1);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'index'(-1) is out of bounds of" + " generics parameters";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeClassClassTypeint05() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:ArrayList(?String)<br>
     * () type:null<br>
     * () index:0<br>
     * <br>
     * () Class:String.class<br>
     * <br>
     * index??????????????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint05() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveType(List.class, GenericPropertyUtil_ArrayListStub01.class,
                null, 0);
        // 
        assertEquals(String.class, actual);
    }

    /**
     * testResolveTypeClassClassTypeint06() <br>
     * <br>
     *  <br>
     * G <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:ArrayList(?String)<br>
     * () type:null<br>
     * () index:1<br>
     * <br>
     * () :IllegalArgumentException<br>
     * "Argument 'index'(1) is out of bounds of"<br>
     * + " generics parameters")<br>
     * <br>
     * index??????IllegalArgumentException?????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint06() throws Exception {
        try {
            // 
            GenericPropertyUtil.resolveType(List.class, GenericPropertyUtil_ArrayListStub01.class, null, 1);
            // 
            fail("???????");
        } catch (IllegalArgumentException e) {
            String message = "Argument 'index'(1) is out of bounds of" + " generics parameters";
            assertEquals(message, e.getMessage());
            assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName());
        }
    }

    /**
     * testResolveTypeClassClassTypeint07() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:ArrayList.class<br>
     * () type:List.class<br>
     * () index:0<br>
     * <br>
     * () Class:Object.class<br>
     * () :<br>
     * TRACE "Concrete type of Type(E) was not found in ancestorList([java.util.AbstractList<E>, java.util.List
     * <E>])"<br>
     * <br>
     * ????????Object??????? ???????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint07() throws Exception {
        // 
        Class<?> actual = GenericPropertyUtil.resolveType(List.class, ArrayList.class, List.class, 0);
        // 
        assertEquals(Object.class, actual);
        assertThat(logger.getLoggingEvents(), is(asList(trace("Concrete type of Type(E) was "
                + "not found in ancestorList([java.util.AbstractList<E>, " + "java.util.List<E>])"))));
    }

    /**
     * testResolveTypeClassClassTypeint08() <br>
     * <br>
     *  <br>
     * E <br>
     * <br>
     * () genericClass:List.class<br>
     * () clazz:ArrayList.class<br>
     * () type:List<String>?ParameterizedType<br>
     * () index:0<br>
     * <br>
     * () Class:String.class<br>
     * () :<br>
     * TRACE "Argument 'genericClass'(java.util.List) does not declare type parameter"<br>
     * <br>
     * type????????????? ???????? <br>
     * @throws Exception ?????
     */
    @Test
    public void testResolveTypeClassClassTypeint08() throws Exception {
        // ??
        Method method = GenericPropertyUtil_Stub01.class.getMethod("getList1", new Class[0]);
        Type type = method.getGenericReturnType();

        // 
        Class<?> actual = GenericPropertyUtil.resolveType(List.class, List.class, type, 0);
        // 
        assertEquals(String.class, actual);
        assertThat(logger.getLoggingEvents(), is(asList(
                trace("Argument " + "'genericClass'(java.util.List) does not " + "declare type parameter"))));
    }
}