>Hi;

>For those that hit the same problem - you need to call super.setUp() and
>super.tearDown() in your setUp/tearDown.

Yeap, that's where the heavy lifting is done.

http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/test-framework/src/java/org/apache/shale/test/base/AbstractJsfTestCase.java?rev=209653&view=markup

>Also, servletContext.getRealPath() is not implemented in the mock objects.
>Is there a reason why it doesn't return the default directory?

I expect the answer is that the mock implementations are only mock.  In a test 
case you might want the real path to be packaged in the jar verses the root 
directory of where the test case is invoked from.

For example, there is a clay test case (ConfigTestCase)  that overrides the 
default mock implementation of the servlet context with an anonymous class.  If 
you do this you have to make sure that you pass the reference to all the other 
mock objects (MockExternalContext, MockFacesContext) if needed in your test 
case. 


>Finally, I need to determine at one place in my code if I am running as a
>test or for real. Any suggestions on the best way to do it?


One way might be to use an init parameter in the setUp method of your test 
case.  Something like this: 

servletContext.addInitParameter("mode", "debug");

String mode = facesContext.getExternalContext().getInitParameter("mode");
if (mode != null)
  //debug


Gary

>Thanks - dave



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to