[jboss-user] [JBoss Seam] - Re: Inject a mocked component for integration testing
lowecg2004
do-not-reply at jboss.com
Sat Jun 2 08:24:52 EDT 2007
You're welcome. As a general solution to invoking e-mails from test code, I use this:
import java.io.IOException;
|
| import javax.faces.context.FacesContext;
|
| import org.jboss.seam.InterceptionType;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Install;
| import org.jboss.seam.annotations.Intercept;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.ui.facelet.FaceletsRenderer;
|
| import com.sun.facelets.Facelet;
|
| @Scope(ScopeType.STATELESS)
| @Intercept(InterceptionType.NEVER)
| @Name("org.jboss.seam.core.renderer")
| @Install(precedence = Install.MOCK, classDependencies = { "com.sun.facelets.Facelet" })
| public class FaceletsRendererMock extends FaceletsRenderer
| {
| @Override
| protected void renderFacelet(final FacesContext facesContext,
| final Facelet facelet)
| throws IOException
| {
| // This mock will be used when sending e-mails.
|
| // JSF cannot render in testng environment so this mock version does nothing.
| // Despite this, allowing the rest of the Renderer to run will still catch
| // blatently malformed documents (unterminated XML tags for example).
| }
|
| }
Place this somewhere in your test source folder.
Hope this is useful.
Ps. Sorry it took me so long to reply - I'd not checked the "notify me" option on this thread.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050670#4050670
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050670
More information about the jboss-user
mailing list