public class MockInterceptor extends Object implements javax.enterprise.inject.spi.Interceptor<MockInterceptor.MockInterceptorInstance>
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).
WeldInitiator.Builder#addBean(Bean)| Modifier and Type | Class and Description |
|---|---|
static class |
MockInterceptor.Builder |
static interface |
MockInterceptor.InterceptionCallback |
static class |
MockInterceptor.MockInterceptorInstance |
| Modifier and Type | Method and Description |
|---|---|
MockInterceptor.MockInterceptorInstance |
create(javax.enterprise.context.spi.CreationalContext<MockInterceptor.MockInterceptorInstance> creationalContext) |
void |
destroy(MockInterceptor.MockInterceptorInstance instance,
javax.enterprise.context.spi.CreationalContext<MockInterceptor.MockInterceptorInstance> creationalContext) |
Class<?> |
getBeanClass() |
Set<javax.enterprise.inject.spi.InjectionPoint> |
getInjectionPoints() |
Set<Annotation> |
getInterceptorBindings() |
String |
getName() |
Set<Annotation> |
getQualifiers() |
Class<? extends Annotation> |
getScope() |
Set<Class<? extends Annotation>> |
getStereotypes() |
Set<Type> |
getTypes() |
Object |
intercept(javax.enterprise.inject.spi.InterceptionType type,
MockInterceptor.MockInterceptorInstance instance,
javax.interceptor.InvocationContext ctx) |
boolean |
intercepts(javax.enterprise.inject.spi.InterceptionType type) |
boolean |
isAlternative() |
boolean |
isNullable() |
static MockInterceptor.Builder |
withBindings(Annotation... interceptorBindings) |
public static MockInterceptor.Builder withBindings(Annotation... interceptorBindings)
interceptorBindings - public Set<Annotation> getInterceptorBindings()
getInterceptorBindings in interface javax.enterprise.inject.spi.Interceptor<MockInterceptor.MockInterceptorInstance>public boolean intercepts(javax.enterprise.inject.spi.InterceptionType type)
intercepts in interface javax.enterprise.inject.spi.Interceptor<MockInterceptor.MockInterceptorInstance>public Object intercept(javax.enterprise.inject.spi.InterceptionType type, MockInterceptor.MockInterceptorInstance instance, javax.interceptor.InvocationContext ctx) throws Exception
intercept in interface javax.enterprise.inject.spi.Interceptor<MockInterceptor.MockInterceptorInstance>Exceptionpublic MockInterceptor.MockInterceptorInstance create(javax.enterprise.context.spi.CreationalContext<MockInterceptor.MockInterceptorInstance> creationalContext)
create in interface javax.enterprise.context.spi.Contextual<MockInterceptor.MockInterceptorInstance>public void destroy(MockInterceptor.MockInterceptorInstance instance, javax.enterprise.context.spi.CreationalContext<MockInterceptor.MockInterceptorInstance> creationalContext)
destroy in interface javax.enterprise.context.spi.Contextual<MockInterceptor.MockInterceptorInstance>public Class<?> getBeanClass()
getBeanClass in interface javax.enterprise.inject.spi.Bean<MockInterceptor.MockInterceptorInstance>public Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
getInjectionPoints in interface javax.enterprise.inject.spi.Bean<MockInterceptor.MockInterceptorInstance>public boolean isNullable()
isNullable in interface javax.enterprise.inject.spi.Bean<MockInterceptor.MockInterceptorInstance>public Set<Type> getTypes()
getTypes in interface javax.enterprise.inject.spi.BeanAttributes<MockInterceptor.MockInterceptorInstance>public Set<Annotation> getQualifiers()
getQualifiers in interface javax.enterprise.inject.spi.BeanAttributes<MockInterceptor.MockInterceptorInstance>public Class<? extends Annotation> getScope()
getScope in interface javax.enterprise.inject.spi.BeanAttributes<MockInterceptor.MockInterceptorInstance>public String getName()
getName in interface javax.enterprise.inject.spi.BeanAttributes<MockInterceptor.MockInterceptorInstance>public Set<Class<? extends Annotation>> getStereotypes()
getStereotypes in interface javax.enterprise.inject.spi.BeanAttributes<MockInterceptor.MockInterceptorInstance>public boolean isAlternative()
isAlternative in interface javax.enterprise.inject.spi.BeanAttributes<MockInterceptor.MockInterceptorInstance>Copyright © 2018. All rights reserved.