public void testSet() throws Exception {
FacesContext facesContext = getFacesContext();
System.out.println("Testing setValue() with model bean in session ");
TestBean testBean = new TestBean();
InnerBean inner = new InnerBean();
Inner2Bean innerInner = new Inner2Bean();
Object result = null;
getFacesContext().getExternalContext().getSessionMap().put("TestBean",
testBean);
boolean exceptionThrown = false;
System.setProperty(TestBean.PROP, TestBean.FALSE);
valueExpression = this.create("TestBean.one");
valueExpression.setValue(getFacesContext().getELContext(), "one");
assertTrue(System.getProperty(TestBean.PROP).equals(TestBean.TRUE));
InnerBean newInner = new InnerBean();
valueExpression = this.create("TestBean.inner");
valueExpression.setValue(getFacesContext().getELContext(), newInner);
result = valueExpression.getValue(getFacesContext().getELContext());
assertTrue(result == newInner);
// Test two levels of nesting
System.setProperty(TestBean.PROP, TestBean.FALSE);
valueExpression = this.create("sessionScope.TestBean.inner.two");
valueExpression.setValue(getFacesContext().getELContext(), "two");
assertTrue(System.getProperty(TestBean.PROP).equals(TestBean.TRUE));
Inner2Bean newInner2 = new Inner2Bean();
valueExpression = this.create("TestBean.inner.inner2");
valueExpression.setValue(getFacesContext().getELContext(), newInner2);
result = valueExpression.getValue(getFacesContext().getELContext());
assertTrue(result == newInner2);