This post originated from an RSS feed registered with Java Buzz
by Simon Brown.
Original Post: TagUnit 1.0 beta 2 available
Feed Title: Simon Brown's weblog
Feed URL: http://www.simongbrown.com/blog/feed.xml?flavor=rss20&category=java
Feed Description: My thoughts on Java, software development and technology.
After uploading the 1.0 beta 1 release of TagUnit, I noticed some problems with the tagunit-examples web application. I've cleaned these up, trimmed a few more files and released this as beta 2.
I've also added a <tagunit:runAs> tag, making it possible to test tags that make use of the servlet security mechanism features. For example, if you have a tag that includes its content if the currently logged in user is in the admin role, you can write something like the following to test your tag.
<tagunit:runAs role="admin">
<tagunit:assertEquals name="Simple test of secured content">
<tagunit:expectedResult>Some content</tagunit:expectedResult>
<tagunit:actualResult>
<someTaglib:ifAdmin>
Some content
</someTaglib:ifAdmin>
</tagunit:actualResult>
</tagunit:assertEquals>
</tagunit:runAs>
The only caveat is that I've only implemented enough to make this tag useful if your tag uses the isUserInRole() and getRemoteUser() methods of the ServletRequest class. What do you think? Is this a useful addition for the 1.0 release?
As before, you can download the latest release here and feedback is appreciated. My next task is to review the user guide again and make any necessary changes.