Hi  Miguel:

How did you generate the error message?

(A)Did you add the message key to the action errors, like:
     this.addActionError("error.authorisation");
(B)or did you retrieve the message text by the key, then add the text
to the action errors, like:
     this.addActionError(this.getText("error.authorisation"));

Method (B) is correct, (A) is not.




2011/11/16 Miguel Almeida <mig...@almeida.at>:
> Dear all,
>
> I am unit-testing an application under the skin using
> SpringStrutsTestCase as base (actually, things are a bit more
> complicated because I'm doing it from Cucumber, but that's another
> story).
>
> How do you get the value of your message from within the test? The
> assertion I'm trying is:
>
> assertEquals(expectedMessage,
> action.getActionErrors().iterator().next());
>
> But actionErrors() contains the key (error.authorisation) and not the
> value ("you cannot do this"). What's the cleanest way to retrieve the
> value from the test?
>
>
> Cheers,
>
> Miguel Almeida
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to