DefaultStandaloneContextAwareManagerFactory extends StandaloneWroManagerFactory implements StandaloneContextAware { public void initialize(final StandaloneContext standaloneContext) { notNull(standaloneContext); this.standaloneContext = standaloneContext; if (standaloneContext.getIgnoreMissingResourcesAsString() != null) { Context.get().getConfig().setIgnoreMissingResources(Boolean.parseBoolean(standaloneContext.getIgnoreMissingResourcesAsString())); } LOG.debug("initialize: {}", standaloneContext); LOG.debug("config: {}", Context.get().getConfig()); }  void initialize(final StandaloneContext standaloneContext);  }
@Test(expected = NullPointerException.class) public void cannotInitializeWithNullContext() { victim.initialize(null); }
@Test public void shouldNotChangeIgnoreMissingResourcesByDefault() { final StandaloneContext standaloneContext = new StandaloneContext(); final boolean ignoreMissingResourcesBefore = Context.get().getConfig().isIgnoreMissingResources(); victim.initialize(standaloneContext); final boolean ignoreMissingResourcesAfter = Context.get().getConfig().isIgnoreMissingResources(); assertEquals(ignoreMissingResourcesBefore, ignoreMissingResourcesAfter); assertTrue(ignoreMissingResourcesAfter); }
@Test public void shouldOverrideIgnoreMissingResourcesUsedInStandaloneContext() { final StandaloneContext standaloneContext = new StandaloneContext(); standaloneContext.setIgnoreMissingResourcesAsString(Boolean.FALSE.toString()); final boolean ignoreMissingResourcesBefore = Context.get().getConfig().isIgnoreMissingResources(); victim.initialize(standaloneContext); final boolean ignoreMissingResourcesAfter = Context.get().getConfig().isIgnoreMissingResources(); assertNotEquals(ignoreMissingResourcesBefore, ignoreMissingResourcesAfter); assertFalse(ignoreMissingResourcesAfter); }