WindowScope implements Scope { @NonNull WindowScopeManager.ScopeMap getScopeMap() { FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext == null) { throw new IllegalStateException("No FacesContext found"); } WindowScopeManager.ScopeMap scopeMap = WindowScopeManager.lookupWindowScope(facesContext); if (scopeMap == null) { throw new IllegalStateException("No ScopeMap found"); } return scopeMap; }  @SuppressWarnings("unchecked") @Override Object get(String name, ObjectFactory<?> objectFactory); @Override Object remove(String name); @Override void registerDestructionCallback(String name, Runnable runnable); @Override Object resolveContextualObject(String name); @Override String getConversationId();  }
@Test public void testGetScopeMap_noScopeMap() { Assertions.assertThrows(IllegalStateException.class, () -> new WindowScope().getScopeMap() ); }
@Test public void testGetScopeMap_noFacesContext() { FacesContext.getCurrentInstance().release(); Assertions.assertThrows(IllegalStateException.class, () -> new WindowScope().getScopeMap() ); }