ApplicationManager applicationManager = TestApplicationManager.newApplicationManager(new ModuleClassLoaderRegistry(), moduleStateHolder, new DelegatingServiceRegistry());
Application application = applicationManager.getCurrentApplication();
RootModuleDefinition test1Definition = newTest1().getModuleDefinition();
ModificationExtractor calculator = new StrictModificationExtractor();
TransitionSet transitions = calculator.getTransitions(application, null, test1Definition);
transitionManager.processTransitions(moduleStateHolder, application, transitions);
ConfigurableApplicationContext context = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
service((FileMonitor) context.getBean("bean1"));
noService((FileMonitor) context.getBean("bean3"));
RootModuleDefinition test2Definition = newTest2().getModuleDefinition();
transitions = calculator.getTransitions(application, test1Definition, test2Definition);
transitionManager.processTransitions(moduleStateHolder, application, transitions);
context = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
service((FileMonitor) context.getBean("bean1"));
//now we got bean3