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.apache.commons.beanutils2.bugs.other.Jira273BeanFactory;
23 import org.apache.commons.logging.Log;
24 import org.apache.commons.logging.LogFactory;
25 import org.junit.jupiter.api.AfterEach;
26 import org.junit.jupiter.api.BeforeEach;
27 import org.junit.jupiter.api.Test;
28
29
30
31
32
33
34 public class Jira273Test {
35
36 private static final Log LOG = LogFactory.getLog(Jira273Test.class);
37
38
39
40
41
42
43 @BeforeEach
44 protected void setUp() throws Exception {
45 }
46
47
48
49
50
51
52 @AfterEach
53 protected void tearDown() throws Exception {
54 }
55
56
57
58
59 @Test
60 public void testIssue_BEANUTILS_273_AnonymousNotOverridden() throws Exception {
61 final Object bean = Jira273BeanFactory.createAnonymousNotOverridden();
62 final Object result = PropertyUtils.getProperty(bean, "beanValue");
63 assertEquals("PublicBeanWithMethod", result);
64 }
65
66
67
68
69 @Test
70 public void testIssue_BEANUTILS_273_AnonymousOverridden() throws Exception {
71 final Object bean = Jira273BeanFactory.createAnonymousOverridden();
72 final Object result = PropertyUtils.getProperty(bean, "beanValue");
73 assertEquals("AnonymousOverridden", result);
74 }
75
76
77
78
79 @Test
80 public void testIssue_BEANUTILS_273_PrivatePrivatePublicNotOverridden() throws Exception {
81 final Object bean = Jira273BeanFactory.createPrivatePrivatePublicNotOverridden();
82 final Object result = PropertyUtils.getProperty(bean, "beanValue");
83 assertEquals("PublicBeanWithMethod", result);
84 }
85
86
87
88
89 @Test
90 public void testIssue_BEANUTILS_273_PrivatePrivatePublicOverridden() throws Exception {
91 final Object bean = Jira273BeanFactory.createPrivatePrivatePublicOverridden();
92 final Object result = PropertyUtils.getProperty(bean, "beanValue");
93 assertEquals("PrivatePrivatePublicOverridden", result);
94 }
95
96
97
98
99 @Test
100 public void testIssue_BEANUTILS_273_PrivatePublicNotOverridden() throws Exception {
101 final Object bean = Jira273BeanFactory.createPrivatePublicNotOverridden();
102 final Object result = PropertyUtils.getProperty(bean, "beanValue");
103 assertEquals("PublicBeanWithMethod", result);
104 }
105
106
107
108
109 @Test
110 public void testIssue_BEANUTILS_273_PrivatePublicOverridden() throws Exception {
111 final Object bean = Jira273BeanFactory.createPrivatePublicOverridden();
112 final Object result = PropertyUtils.getProperty(bean, "beanValue");
113 assertEquals("PrivatePublicOverridden", result);
114 }
115 }