@Test public void testLogout() { expect(FacesContext.getCurrentInstance()).andReturn(facesContext) .once(); expect(facesContext.getExternalContext()).andReturn(externalContext) .once(); externalContext.invalidateSession(); expectLastCall().once(); PowerMock.replay(FacesContext.class); replay(facesContext); replay(externalContext); assertEquals("logout?faces-redirect=true", someBean.logout()); PowerMock.verify(FacesContext.class); verify(facesContext); verify(externalContext); }
public String logout() { FacesContext.getCurrentInstance().getExternalContext() .invalidateSession(); return "logout?faces-redirect=true"; }
SomeBean { public String logout() { FacesContext.getCurrentInstance().getExternalContext() .invalidateSession(); return "logout?faces-redirect=true"; } }
SomeBean { public String logout() { FacesContext.getCurrentInstance().getExternalContext() .invalidateSession(); return "logout?faces-redirect=true"; }  }
SomeBean { public String logout() { FacesContext.getCurrentInstance().getExternalContext() .invalidateSession(); return "logout?faces-redirect=true"; }  void addMessage(Severity severity, String summary, String detail); String logout(); }
SomeBean { public String logout() { FacesContext.getCurrentInstance().getExternalContext() .invalidateSession(); return "logout?faces-redirect=true"; }  void addMessage(Severity severity, String summary, String detail); String logout();  }