SpringContextFactory { public ApplicationContext createSpringContext() { try { ApplicationContext springContext = springBuilder.createSpringApp(config, classes.stream().toArray(i->new Class[classes.size()])); return springContext; } catch (Exception e) { logger.error(InternalErrorCode.STARTUP_FAILED_SPRING_INITIALISATION.toString(), e.getMessage()); ExceptionSoftener.throwSoftenedException(e); } return null; } SpringContextFactory(Config config, Class<?> c, Set<Class<?>> classes);  SpringContextFactory(SpringBuilder builder, Config config, Class<?> c, Set<Class<?>> classes); ApplicationContext createSpringContext(); Class[] classes();  }
@Test public void blacklisting() { SpringBuilder springBuilder = mock(SpringBuilder.class); Set<Class<?>> classes = new HashSet<>(); classes.add(Integer.class); classes.add(String.class); Config config = Config.instance().withBasePackages(new String[] {"com.aol.micro.server.spring"}).set(); new SpringContextFactory(config ,this.getClass(), classes).withSpringBuilder(springBuilder).createSpringContext(); ArgumentCaptor<Class> varArgs = ArgumentCaptor.forClass(Class.class); verify(springBuilder).createSpringApp(anyObject(), varArgs.capture()); Assert.assertTrue(varArgs.getAllValues().contains(String.class)); Assert.assertFalse(varArgs.getAllValues().contains(Integer.class)); }