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 junit.framework.Test;
20 import junit.framework.TestCase;
21 import junit.framework.TestSuite;
22
23 import org.apache.commons.beanutils.PropertyUtils;
24 import org.apache.commons.beanutils.TestBean;
25
26
27
28
29
30 public class Jira358TestCase extends TestCase {
31
32
33
34
35
36
37 public Jira358TestCase(final String name) {
38 super(name);
39 }
40
41
42
43
44
45
46 public static void main(final String[] args) {
47 junit.textui.TestRunner.run(suite());
48 }
49
50
51
52
53
54
55 public static Test suite() {
56 return (new TestSuite(Jira358TestCase.class));
57 }
58
59
60
61
62
63
64 @Override
65 protected void setUp() throws Exception {
66 super.setUp();
67 }
68
69
70
71
72
73
74 @Override
75 protected void tearDown() throws Exception {
76 super.tearDown();
77 }
78
79
80
81
82 public void testPropertyUtils_getIndexedProperty_Array() throws Exception {
83
84 final TestBean bean = new TestBean();
85 try {
86 PropertyUtils.getIndexedProperty(bean, "intArray", bean.getIntArray().length);
87 fail("Expected ArrayIndexOutOfBoundsException");
88 } catch (final ArrayIndexOutOfBoundsException e) {
89
90 }
91 }
92
93
94
95
96 public void testPropertyUtils_getIndexedProperty_List() throws Exception {
97
98 final TestBean bean = new TestBean();
99 try {
100 PropertyUtils.getIndexedProperty(bean, "listIndexed", bean.getListIndexed().size());
101 fail("Expected IndexOutOfBoundsException");
102 } catch (final IndexOutOfBoundsException e) {
103
104 }
105 }
106 }