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