views:

146

answers:

1

I would like to add a unit test to test the style class gets set correctly. Unfortunately the getter getStyleClass requires a FacesContext. Any ideas?

+2  A: 

Use JSFUnit. It's designed for exactly those purposes. Here's how it introduces itself:

JSFUnit is a test framework for JSF applications. It is designed to allow complete integration testing and unit testing of JSF applications using a simplified API. JSFUnit tests run inside the container, which provides the developer full access to managed beans, the FacesContext, EL Expressions, and the internal JSF component tree. At the same time, you also have access to parsed HTML output of each client request.

BalusC