@Test public void testIgnoreModules() { final ContainerAdaptor defaultAdaptor = mock(ContainerAdaptor.class); List<ApplicationProcessor> processors = new ArrayList<ApplicationProcessor>(); processors.add(new ProcessorA()); processors.add(new ProcessorB()); processors.add(new ProcessorC()); when(defaultAdaptor.getInstancesOfType(ApplicationProcessor.class)).thenReturn(processors); ca = defaultAdaptor; builder.setModulesProviderClass(MockContainerAdaptorFactory.class); builder.addApplicationProcessorClass(ApplicationProcessor.class); Modules modules = builder.buildModules(resolver, defaultAdaptor); List<ApplicationProcessor> actual = modules.getApplicationProcessors(); log.debug(actual.toString()); assertThat(actual.size(), is(3)); builder.ignore(ProcessorB.class); modules = builder.buildModules(resolver, defaultAdaptor); actual = modules.getApplicationProcessors(); log.debug(actual.toString()); assertThat(actual.size(), is(1)); }
@Test @SuppressWarnings({"rawtypes", "unchecked"}) public void testIgnoreTypesUndefined() { thrown.expect(AssertionFailureException.class); builder.ignore((Class) null); }