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.assertFalse;
20 import static org.junit.jupiter.api.Assertions.assertThrows;
21
22 import org.apache.commons.beanutils2.PropertyUtils;
23 import org.apache.commons.beanutils2.bugs.other.Jira18BeanFactory;
24 import org.junit.jupiter.api.BeforeAll;
25 import org.junit.jupiter.api.Test;
26
27
28
29
30
31
32
33
34
35 public class Jira18Test {
36
37 private static Object bean;
38
39 @BeforeAll
40 public static void beforeAll() {
41 bean = Jira18BeanFactory.createBean();
42 }
43
44
45
46
47 @Test
48 public void testIssue_BEANUTILS_18_PropertyUtils_getProperty() {
49 assertThrows(NoSuchMethodException.class, () -> PropertyUtils.getProperty(bean, "simple"));
50 }
51
52
53
54
55 @Test
56 public void testIssue_BEANUTILS_18_PropertyUtils_getProperty_Indexed() {
57 assertThrows(NoSuchMethodException.class, () -> PropertyUtils.getProperty(bean, "indexed[0]"));
58 }
59
60
61
62
63 @Test
64 public void testIssue_BEANUTILS_18_PropertyUtils_getProperty_Mapped() {
65 assertThrows(NoSuchMethodException.class, () -> PropertyUtils.getProperty(bean, "mapped(foo-key)"));
66 }
67
68
69
70
71 @Test
72 public void testIssue_BEANUTILS_18_PropertyUtils_isReadable() {
73 assertFalse(PropertyUtils.isReadable(bean, "simple"));
74 }
75
76
77
78
79 @Test
80 public void testIssue_BEANUTILS_18_PropertyUtils_isReadable_Indexed() {
81 assertFalse(PropertyUtils.isReadable(bean, "indexed"));
82 }
83
84
85
86
87 @Test
88 public void testIssue_BEANUTILS_18_PropertyUtils_isReadable_Mapped() {
89 assertFalse(PropertyUtils.isReadable(bean, "mapped"));
90 }
91
92
93
94
95 @Test
96 public void testIssue_BEANUTILS_18_PropertyUtils_isWriteable() {
97 assertFalse(PropertyUtils.isWriteable(bean, "simple"));
98 }
99
100
101
102
103 @Test
104 public void testIssue_BEANUTILS_18_PropertyUtils_isWriteable_Indexed() {
105 assertFalse(PropertyUtils.isWriteable(bean, "indexed"));
106 }
107
108
109
110
111 @Test
112 public void testIssue_BEANUTILS_18_PropertyUtils_isWriteable_Mapped() {
113 assertFalse(PropertyUtils.isWriteable(bean, "mapped"));
114 }
115
116
117
118
119 @Test
120 public void testIssue_BEANUTILS_18_PropertyUtils_setProperty() {
121 assertThrows(NoSuchMethodException.class, () -> PropertyUtils.setProperty(bean, "simple", "BAR"));
122 }
123
124
125
126
127 @Test
128 public void testIssue_BEANUTILS_18_PropertyUtils_setProperty_Indexed() {
129 assertThrows(NoSuchMethodException.class, () -> PropertyUtils.setProperty(bean, "indexed[0]", "BAR"));
130 }
131
132
133
134
135 @Test
136 public void testIssue_BEANUTILS_18_PropertyUtils_setProperty_Mapped() {
137 assertThrows(NoSuchMethodException.class, () -> PropertyUtils.setProperty(bean, "mapped(foo-key)", "BAR"));
138 }
139 }