1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.web.struts.form.pojo;
17
18 import org.apache.commons.beanutils.PropertyUtils;
19 import org.junit.Before;
20 import org.junit.Ignore;
21 import org.junit.Test;
22
23 import static org.junit.Assert.assertFalse;
24
25 public class PojoPropertyUtilsBeanTest {
26
27 @Before
28
29
30
31
32 public void setup() {
33 PojoPlugin.initBeanUtils();
34 }
35
36 @Ignore
37
38
39
40
41 @Test
42
43
44
45
46
47 public void testNestedPropertyIsWriteable() {
48 ReadonlyBean testBean = new ReadonlyBean();
49 ReadonlyWrappingBean readonlyBean = new ReadonlyWrappingBean(testBean);
50 WriteableWrappingBean writeableBean = new WriteableWrappingBean(testBean);
51
52 assertFalse(PropertyUtils.isWriteable(readonlyBean, "bean.value"));
53 assertFalse(PropertyUtils.isWriteable(writeableBean, "bean.value"));
54 }
55
56 private static class ReadonlyBean {
57
58 private Boolean value;
59
60 public Boolean getValue() {
61 return value;
62 }
63 }
64
65 private static class ReadonlyWrappingBean {
66
67 private ReadonlyBean bean;
68
69 public ReadonlyWrappingBean(ReadonlyBean bean) {
70 this.bean = bean;
71 }
72
73 public ReadonlyBean getBean() {
74 return bean;
75 }
76 }
77
78 private static class WriteableWrappingBean {
79
80 private ReadonlyBean bean;
81
82 public WriteableWrappingBean(ReadonlyBean bean) {
83 this.bean = bean;
84 }
85
86 public ReadonlyBean getBean() {
87 return bean;
88 }
89
90 public void setBean(ReadonlyBean bean) {
91 this.bean = bean;
92 }
93 }
94 }