public void testSetNull() throws Exception {
FacesContext facesContext = getFacesContext();
System.out.println(
"Testing setValue() with model bean in session with null rValues");
TestBean testBean = new TestBean();
InnerBean inner = new InnerBean();
Inner2Bean innerInner = new Inner2Bean();
getFacesContext().getExternalContext().getSessionMap().put("TestBean",
testBean);
// Test one level of nesting
valueBinding = this.create("TestBean.one");
valueBinding.setValue(getFacesContext(), null);
assertTrue(testBean.getOne() == null);
System.setProperty(TestBean.PROP, TestBean.FALSE);
valueBinding = this.create("sessionScope.TestBean.inner");
valueBinding.setValue(getFacesContext(), inner);
assertTrue(System.getProperty(TestBean.PROP).equals(TestBean.TRUE));
valueBinding = this.create("sessionScope.TestBean.inner");
valueBinding.setValue(getFacesContext(), null);
assertTrue(testBean.getInner() == null);
// Inner bean does not exist anymore. So this should result in an
// exception.
boolean exceptionThrown = false;
valueBinding = this.create("sessionScope.TestBean.inner.two");