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.BeanUtils;
24
25
26
27
28
29 public class Jira369TestCase extends TestCase {
30
31
32
33
34
35
36 public Jira369TestCase(final String name) {
37 super(name);
38 }
39
40
41
42
43
44
45 public static void main(final String[] args) {
46 junit.textui.TestRunner.run(suite());
47 }
48
49
50
51
52
53
54 public static Test suite() {
55 return (new TestSuite(Jira369TestCase.class));
56 }
57
58
59
60
61
62
63 @Override
64 protected void setUp() throws Exception {
65 super.setUp();
66 }
67
68
69
70
71
72
73 @Override
74 protected void tearDown() throws Exception {
75 super.tearDown();
76 }
77
78
79
80
81 public void testBeanUtilsGetProperty_aRatedCd() throws Exception {
82 final TestBean bean = new TestBean();
83 bean.setARatedCd("foo");
84
85 try {
86 assertEquals("foo", BeanUtils.getProperty(bean, "aRatedCd"));
87 fail("Expected NoSuchMethodException");
88 } catch (final NoSuchMethodException e) {
89
90 } catch (final Exception e) {
91 fail("Threw " + e);
92 }
93 }
94
95
96
97
98 public void testBeanUtilsGetProperty_ARatedCd() throws Exception {
99 final TestBean bean = new TestBean();
100 bean.setARatedCd("foo");
101 try {
102 assertEquals("foo", BeanUtils.getProperty(bean, "ARatedCd"));
103 } catch (final Exception e) {
104 fail("Threw " + e);
105 }
106 }
107
108
109
110
111 public void testBeanUtilsGetProperty_bRatedCd() throws Exception {
112 final TestBean bean = new TestBean();
113 bean.setbRatedCd("foo");
114 try {
115 assertEquals("foo", BeanUtils.getProperty(bean, "bRatedCd"));
116 } catch (final Exception e) {
117 fail("Threw " + e);
118 }
119 }
120
121
122
123
124 public static class TestBean {
125 private String aproperty;
126 private String bproperty;
127
128 public String getARatedCd() {
129 return aproperty;
130 }
131
132 public void setARatedCd(final String aproperty) {
133 this.aproperty = aproperty;
134 }
135
136 public String getbRatedCd() {
137 return bproperty;
138 }
139
140 public void setbRatedCd(final String bproperty) {
141 this.bproperty = bproperty;
142 }
143 }
144 }