### Question:
FlashImpl extends Flash implements ReleasableFlash { @Override public void keep(String key) { _checkFlashScopeDisabled(); FacesContext facesContext = FacesContext.getCurrentInstance(); Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap(); Object value = requestMap.get(key); if (value == null) { Map<String, Object> executeMap = _getExecuteFlashMap(facesContext); if (executeMap != null) { value = executeMap.get(key); requestMap.put(key, value); } } _getRenderFlashMap(facesContext).put(key, value); facesContext.getApplication().publishEvent(facesContext, PostKeepFlashValueEvent.class, key); } FlashImpl(ExternalContext externalContext); static Flash getCurrentInstance(ExternalContext context); static Flash getCurrentInstance(ExternalContext context, boolean create); @Override void doPrePhaseActions(FacesContext facesContext); @Override void doPostPhaseActions(FacesContext facesContext); @Override boolean isRedirect(); @Override void setRedirect(boolean redirect); @Override void keep(String key); @Override void putNow(String key, Object value); @Override boolean isKeepMessages(); @Override void setKeepMessages(boolean keepMessages); @Override void clear(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override Set<java.util.Map.Entry<String, Object>> entrySet(); @Override Object get(Object key); @Override boolean isEmpty(); @Override Set<String> keySet(); @Override Object put(String key, Object value); @Override void putAll(Map<? extends String, ? extends Object> m); @Override Object remove(Object key); @Override int size(); @Override Collection<Object> values(); @Override void clearFlashMap(FacesContext facesContext, String clientWindowId, String token);  }### Answer:
@Test public void testKeep() throws Exception { ((MockFacesContext20) facesContext).setPostback(false); facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW); _flash.doPrePhaseActions(facesContext); facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE); _flash.doPostPhaseActions(facesContext); _simulateNewRequest(); ((MockFacesContext20) facesContext).setPostback(true); facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW); _flash.doPrePhaseActions(facesContext); facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION); _flash.putNow("flashkey", "flashvalue"); _flash.keep("flashkey"); facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE); _flash.doPostPhaseActions(facesContext); _simulateNewRequest(); ((MockFacesContext20) facesContext).setPostback(true); facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW); _flash.doPrePhaseActions(facesContext); facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION); Assert.assertEquals("flashvalue", _flash.get("flashkey")); facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE); _flash.doPostPhaseActions(facesContext); }