Skip to content

Commit

Permalink
#239 Injector should not be set in case of testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Polevoy committed Sep 23, 2015
1 parent b492052 commit 259f26c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ private void initAppConfig(String configClassName, AppContext context, boolean f
appConfig.init(context);
if(appConfig instanceof Bootstrap){
appBootstrap = (Bootstrap) appConfig;
Injector injector = appBootstrap.getInjector();
if(!Configuration.isTesting() ){
Context.getControllerRegistry().setInjector(appBootstrap.getInjector());
if(Context.getControllerRegistry().getInjector() != null && injector != null){
throw new InitException("Either use setInjector() or getInjector(), but not both...");
}
Context.getControllerRegistry().setInjector(injector);
}
}
appConfig.completeInit();
Expand Down

0 comments on commit 259f26c

Please sign in to comment.