### Question:
SAMLEntryPoint extends GenericFilterBean implements AuthenticationEntryPoint { protected boolean isECPRequest(HttpServletRequest request) { String acceptHeader = request.getHeader("Accept"); String paosHeader = request.getHeader(SAMLConstants.PAOS_HTTP_HEADER); return acceptHeader != null && paosHeader != null && acceptHeader.contains(SAMLConstants.PAOS_HTTP_ACCEPT_HEADER) && paosHeader.contains(org.opensaml.common.xml.SAMLConstants.PAOS_NS) && paosHeader.contains(org.opensaml.common.xml.SAMLConstants.SAML20ECP_NS); }  void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e); void setDefaultProfileOptions(WebSSOProfileOptions defaultOptions); String getIdpSelectionPath(); void setFilterProcessesUrl(String filterSuffix); String getFilterProcessesUrl(); @Deprecated void setFilterSuffix(String filterSuffix); void setIdpSelectionPath(String idpSelectionPath); @Autowired @Qualifier("webSSOprofile") void setWebSSOprofile(WebSSOProfile webSSOprofile); WebSSOProfile getWebSSOprofileECP(); @Autowired(required = false) @Qualifier("ecpprofile") void setWebSSOprofileECP(WebSSOProfile webSSOprofileECP); @Autowired void setSamlLogger(SAMLLogger samlLogger); @Autowired void setContextProvider(SAMLContextProvider contextProvider); @Autowired void setMetadata(MetadataManager metadata); @Override void afterPropertiesSet(); static final String IDP_PARAMETER; static final String LOGIN_PARAMETER; static final String DISCOVERY_RESPONSE_PARAMETER; }### Answer:
@Test public void testECPRequest_no() throws Exception { expect(request.getHeader("Accept")).andReturn( "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); expect(request.getHeader(org.springframework.security.saml.SAMLConstants.PAOS_HTTP_HEADER)).andReturn(null); replayMock(); Assert.assertFalse(entryPoint.isECPRequest(request)); verifyMock(); }
@Test public void testECPRequest_yes() throws Exception { expect(request.getHeader("Accept")).andReturn("text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5, application/vnd.paos+xml"); expect(request.getHeader(org.springframework.security.saml.SAMLConstants.PAOS_HTTP_HEADER)).andReturn("ver='urn:liberty:paos:2003-08'; 'urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp'"); replayMock(); Assert.assertTrue(entryPoint.isECPRequest(request)); verifyMock(); }