[jboss-user] [JBoss Seam] - Mocking @Logger

mustaghattack do-not-reply at jboss.com
Tue Jul 10 05:09:52 EDT 2007

I would like to unit test a Seam SFSB which uses an injected logger.
I didn't find any MockLog so I use the logging factory like that :
setField( editor, "log", Logging.getLog( "test" ) );
It solves the NullPointerException and the test are working fine but when logging, the Interpolator try to access the context which doesnt exist and throws an IllegalStateException ...
It may be useful to have a mockLog method in the SeamTest class which look for a @Logger annotation and inject a MockLog. The MockLog will basically print any log on the console.
What do you think ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062312#4062312

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062312

More information about the jboss-user mailing list