Class MockInterceptor

java.lang.Object
org.jboss.weld.junit.MockInterceptor
All Implemented Interfaces:
Contextual<MockInterceptor.MockInterceptorInstance>, Bean<MockInterceptor.MockInterceptorInstance>, BeanAttributes<MockInterceptor.MockInterceptorInstance>, Interceptor<MockInterceptor.MockInterceptorInstance>

public class MockInterceptor extends Object implements Interceptor<MockInterceptor.MockInterceptorInstance>
This custom Interceptor implementation is useful for mocking.

A new instance is usually created through a MockInterceptor.Builder (see also withBindings(Annotation...) method) and then passed to the WeldInitiator.Builder#addBeans(Bean...) method.

Note that by default all mock interceptors are automatically enabled for the synthetic bean archive. If needed a custom bean class can be set through the MockInterceptor.Builder.beanClass(Class) method - the bean class can be used to enable the interceptor for a bean archive. It's not possible to enable a mock interceptor globally (per application).

Since:
1.2.1
Author:
Martin Kouba See also {code WeldInitiator.Builder#addBean(Bean)} method.