@Before @SuppressWarnings({ "unchecked", "rawtypes" }) public void setup() { MetaClassFactory.getMetaClassCache().clear(); FactoryGenerator.setDependencyGraph(null); final QualifierFactory qualFactory = new DefaultQualifierFactory(); when(injContext.getQualifierFactory()).thenReturn(qualFactory); when(injContext.getInjectableProviders()).thenReturn(HashMultimap.create()); when(injContext.getExactTypeInjectableProviders()).thenReturn(HashMultimap.create()); when(injContext.getAnnotationsForElementType(DependentBean)).thenReturn(Arrays.asList(Dependent.class)); when(injContext.getAnnotationsForElementType(NormalScopedBean)).thenReturn(Arrays.asList(ApplicationScoped.class)); when(injContext.getAnnotationsForElementType(PseudoScopedBean)).thenReturn(Arrays.asList(Singleton.class, Dependent.class)); when(injContext.getAnnotationsForElementType(AlternativeBean)).thenReturn(Arrays.asList(Alternative.class)); when(injContext.getAnnotationsForElementType(InjectionPoint)).thenReturn(Arrays.asList(Inject.class)); when(injContext.getAnnotationsForElementType(ProducerElement)).thenReturn(Arrays.asList(IOCProducer.class)); when(injContext.getAnnotationsForElementType(Provider)).thenReturn(Arrays.asList(IOCProvider.class)); when(injContext.isWhitelisted(any())).thenReturn(true); when(injContext.isBlacklisted(any())).thenReturn(false); final ClassStructureBuilder<?> classBuilder = ClassBuilder .define("org.jboss.errai.ioc.FakeBootstrapperImpl") .publicScope() .implementsInterface(Bootstrapper.class) .body(); final BlockBuilder blockBuilder = classBuilder.publicMethod(ContextManager.class, "bootstrap").body(); when(procContext.getBlockBuilder()).thenReturn(blockBuilder); when(procContext.getBootstrapBuilder()).thenReturn(classBuilder); when(procContext.getBootstrapClass()).thenReturn(classBuilder.getClassDefinition()); processor = new IOCProcessor(injContext); }