Yup - that fixed it. I added the following to my test's setUp() method: vb = facesContext.getApplication().createValueBinding("#{dialog}"); vb.setValue(facesContext, new HashMap());
Thanks for the help, Cheers, Ian. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 19 April 2006 17:38 To: Struts Users Mailing List Subject: Re: setValue() and test-framework >From: "Ian.Priest" <[EMAIL PROTECTED]> > > Hi, > > I think i may have found a bug in the test-framework: > > I'm have a ViewController that calls setValue() as part of it's > set-up... > > > public class SignupViewController extends AbstractViewController { > > private static final String DIALOG_DATA = "#{dialog.data}"; > > public String setup() { > > ... > > // Register the dialogData object for this dialog, and continue > setValue(DIALOG_DATA, dialogData); return SUCCESS; > > } > > However, in my test-class the setValue() call causes a > NullPointerException. Here's my test... > > public class SignupViewControllerTest extends > AbstractViewControllerTestCase { > > public static Test suite() { > return (new TestSuite(SignupViewControllerTest.class)); > } > > SignupViewController vc = null; > > public void setUp() { > super.setUp(); > > vc = new SignupViewController(); > } > > public SignupViewControllerTest(String arg0) { super(arg0); } > > public void testSetup() { > > vc.setDialogData(new SignupData()); > // run setup > vc.setup(); > ... > } > I think this null pointer is thrown because the object "dialog" can't be resolved in any scope. "#{dialog.data}" Try staging a Map in session scope in the setup using the "dialog" key. Gary > Here's the stack trace > > java.lang.NullPointerException > at > org.apache.shale.test.mock.MockPropertyResolver.setValue(MockPropertyR > es > olver.java:98) > at > org.apache.shale.test.mock.MockValueBinding.setValue(MockValueBinding. > ja > va:159) > at > org.apache.shale.view.AbstractFacesBean.setValue(AbstractFacesBean.java: > 215) > at > com.scn.web.dialog.signup.SignupViewController.setup(SignupViewControl > le > r.java:65) > at > com.scn.web.dialog.signup.SignupViewControllerTest.testSetup(SignupVie > wC > ontrollerTest.java:45) > ... > > Anyone else come across this? > > Cheers, > Ian > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]