/*
 * 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.bugs;

import org.apache.commons.beanutils.PropertyUtils;

import java.util.ArrayList;

import junit.framework.TestCase;

/**
 * getPropertyType return null on second descendant class
 *
 * <p />
 * See https://issues.apache.org/jira/browse/BEANUTILS-422
 * <p />
 *
 * @version $Revision$ $Date$
 */
public class Jira422TestCase extends TestCase {

    public void testRootBean() throws Exception {
        RootBean bean = new FirstChildBean();
        Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
        assertEquals(String.class.getName(), propertyType.getName());
    }

    public void testSecondChildBean() throws Exception {
        RootBean bean = new SecondChildBean();
        Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
        assertEquals(String.class.getName(), propertyType.getName());
    }

}

class RootBean {

    private ArrayList file;

    public ArrayList getFile() {
        return file;
    }

    public void setFile(ArrayList file) {
        this.file = file;
    }

    public String getFile(int i) {
        return (String) file.get(i);
    }

    public void setFile(int i, String file) {
        this.file.set(i, file);
    }

}

class FirstChildBean extends RootBean {
}

class SecondChildBean extends RootBean {
}

/*
 * 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.bugs;

import org.apache.commons.beanutils.PropertyUtils;

import java.util.ArrayList;

import junit.framework.TestCase;

/**
 * getPropertyType return null on second descendant class
 *
 * <p />
 * See https://issues.apache.org/jira/browse/BEANUTILS-422
 * <p />
 *
 * @version $Id$
 */
public class Jira422TestCase extends TestCase {

    public void testRootBean() throws Exception {
        RootBean bean = new FirstChildBean();
        Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
        assertEquals(String.class.getName(), propertyType.getName());
    }

    public void testSecondChildBean() throws Exception {
        RootBean bean = new SecondChildBean();
        Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
        assertEquals(String.class.getName(), propertyType.getName());
    }

}

class RootBean {

    private ArrayList file;

    public ArrayList getFile() {
        return file;
    }

    public void setFile(ArrayList file) {
        this.file = file;
    }

    public String getFile(int i) {
        return (String) file.get(i);
    }

    public void setFile(int i, String file) {
        this.file.set(i, file);
    }

}

class FirstChildBean extends RootBean {
}

class SecondChildBean extends RootBean {
}

Use $Id$ SVN keyword instead of $Date$, because it depends on the clients locale (see discussion on the ML http://markmail.org/message/zx4ii6pq4iin2tol).