### Question:
SpringSystemEventListener implements SystemEventListener { public void processEvent(SystemEvent event) throws AbortProcessingException { if (this.logger.isDebugEnabled()) { this.logger.debug("Processing system event " + event); } if (event instanceof PostConstructApplicationEvent) { processPostConstructApplicationEvent((PostConstructApplicationEvent) event); } }  boolean isListenerForSource(Object source); void processEvent(SystemEvent event);  }### Answer:
@SuppressWarnings("unchecked") @Test public void shouldSetSpringApplication() throws Exception { PostConstructApplicationEvent event = mock(PostConstructApplicationEvent.class); Application application = mock(Application.class); given(event.getApplication()).willReturn(application); FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName()); try { this.listener.processEvent(event); MockApplicationFactory applicationFactory = (MockApplicationFactory) FactoryFinder .getFactory(FactoryFinder.APPLICATION_FACTORY); Application actual = applicationFactory.getApplication(); assertThat(actual, is(instanceOf(SpringApplication.class))); assertThat(((FacesWrapper<Application>) actual).getWrapped(), is(sameInstance(application))); } finally { FactoryFinder.releaseFactories(); FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, null); } }