-
1. Re: Unit Testing With TestNG
pmuir Nov 28, 2007 6:44 AM (in response to djfjboss)Bijection should occur when you run integration tests (but obviously not when you run unit tests)
-
2. Re: Unit Testing With TestNG
djfjboss Nov 28, 2007 7:02 AM (in response to djfjboss)So my question is: what do I need to do to fake this bijection when running in unit test mode?
-
3. Re: Unit Testing With TestNG
pmuir Nov 28, 2007 7:05 AM (in response to djfjboss)You'll have to set the properties yourself as you are doing.
-
4. Re: Unit Testing With TestNG
djfjboss Nov 28, 2007 7:10 AM (in response to djfjboss)We seem to be talking at cross purposes here. I do understand that I need to set these properties myself - hence the references to setField in my initial post.
However I do not understand why I get the exception when trying to set the FacesMessage variable. I looked at the source code but emerged none the wiser. I was therefore hoping someone on this forum could shed some light but at the moment we seem to be going round in circles. Is what I am doing basically wrong-headed or is there something else that might explain this exception? -
5. Re: Unit Testing With TestNG
pmuir Nov 28, 2007 7:14 AM (in response to djfjboss)The correct way to deal with this is to do an integration test ;)
Its the FacesMessages.instance() that fails - you need to create a mock FacesMessages class if you *really* want to do this. This is because Seam has not booted at this point so none of the Seam built in components should be expected to work. -
6. Re: Unit Testing With TestNG
djfjboss Nov 28, 2007 7:28 AM (in response to djfjboss)This is the nub of the issue.
I was expecting SeamTest to provide mocks for the normal Seam environment and hence would provide a mocked FacesMessage but it sounds like that isn't the case - I certainly couldn't find one but I was wondering if I was missing something. -
7. Re: Unit Testing With TestNG
pmuir Nov 28, 2007 7:40 AM (in response to djfjboss)SeamTest is for integration testing not unit testing. A mock of FacesMessages isn't needed in an integration test. SeamTest mocks out JSF and Servlet, not Seam itself.
-
8. Re: Unit Testing With TestNG
djfjboss Nov 28, 2007 8:52 AM (in response to djfjboss)Many thanks for confirming what I was beginning to suspect.
However, the reason I started looking at unit testing and TestNG was due to the unit testing chapter in the yuan/heute book which definitely does use SeamTest within a unit test, but is a little vague regarding the issues I encountered.