1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.beanutils.bugs;
18
19 import static org.junit.Assert.assertEquals;
20
21 import org.apache.commons.beanutils.PropertyUtils;
22 import org.junit.Test;
23
24
25
26
27
28
29
30
31 public class Jira422bTestCase {
32
33 @Test
34 public void testRootBean() throws Exception {
35 final RootBeanB bean = new FirstChildBeanB();
36 final Class<?> propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
37 assertEquals(String.class.getName(), propertyType.getName());
38 }
39
40
41 @Test
42 public void testSecondChildBean() throws Exception {
43 final RootBeanB bean = new SecondChildBeanB();
44 final Class<?> propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
45 assertEquals(String.class.getName(), propertyType.getName());
46 }
47
48 }
49
50
51 class RootBeanB {
52
53 private String[] file;
54
55 public String[] getFile() {
56 return file;
57 }
58
59 public void setFile(final String[] file) {
60 this.file = file;
61 }
62
63 public String getFile(final int i) {
64 return file[i];
65 }
66
67 public void setFile(final int i, final String file) {
68 this.file[i] = file;
69 }
70
71 }
72
73 class FirstChildBeanB extends RootBeanB {
74 }
75
76 class SecondChildBeanB extends RootBeanB {
77 }