mock cdi interceptors during junit tests

admin

Administrator
Staff member
I have a complex Java EE 6 app with a web module, an EJB module and some utility jars.

I want to do some integration tests with Junit. Therefore I use the openwebbeans cdi container (Thanks to Mr. Struberg <a href="http://struberg.wordpress.com/2012/03/17/controlling-cdi-containers-in-se-and-ee/" rel="nofollow">http://struberg.wordpress.com/2012/03/17/controlling-cdi-containers-in-se-and-ee/</a>)
It works perfectly. I can start a complete cdi container in a Junit test.

My problem is that I have some interceptors in my application which cannot run in a Junit test (MQ-, persistence- and transaction-interceptors). So I want to mock these interceptor implementations.

Does anybody know how to do this?