예제 #1
0
 @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));
 }
예제 #2
0
 @Test
 @SuppressWarnings({"rawtypes", "unchecked"})
 public void testIgnoreTypesUndefined() {
   thrown.expect(AssertionFailureException.class);
   builder.ignore((Class) null);
 }