>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(MockPropertyRes
> 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(SignupViewControlle
> r.java:65)
> at
> com.scn.web.dialog.signup.SignupViewControllerTest.testSetup(SignupViewC
> ontrollerTest.java:45)
> ...
>
> Anyone else come across this?
>
> Cheers,
> Ian
>