You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Llewellyn Falco <is...@setgame.com> on 2005/04/28 21:53:07 UTC

Junit and Debugging of Velocity Templates

I would like to know which flag to set so when I run my junit tests 

#parse (fileWithErrorInIt)

$real.unknownfield.call()

#if ($real.unknowfield()) .... #end

$real.returnsNull().doSomething()


will all throw errors so my test will fail and I can realize I did something stupid.

thanks.


Re: Junit and Debugging of Velocity Templates

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Llewellyn,

> I would like to know which flag to set so when I run my junit tests
> 
> #parse (fileWithErrorInIt)
> 
> $real.unknownfield.call()
> 
> #if ($real.unknowfield()) .... #end
> 
> $real.returnsNull().doSomething()
> 
> will all throw errors so my test will fail and I can realize I did something stupid.

You should be able to use a customary Introspector.  See the
"Pluggable Introspection" here:
    http://jakarta.apache.org/velocity/developer-guide.html#Velocity%20Configuration%20Keys%20and%20Values

But instead of doing all those tricky stuff, I suggest you read "JUnit
Recipes" by J. B. Rainsberger.  There is a nice recipe for testing
Velocity templates.
    http://www.amazon.com/exec/obidos/tg/detail/-/1932394230    

Best regards,
-- Shinobu

--
Shinobu Kawai <sh...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org