@Test
public void testLogout() {

	MockHttpServletRequest request = new MockHttpServletRequest();
	MockHttpServletResponse response = new MockHttpServletResponse();
	
	CredentialResolver credentialResolver = Mockito.mock(CredentialResolver.class);
	logoutAction.setCredentialResolver(credentialResolver);
	
	Ki4soService ki4soService = Mockito.mock(Ki4soService.class);
	logoutAction.setKi4soService(ki4soService);
	
	//测试没有cookie的情况。
	logoutAction.logout(request, response);
	Assert.assertEquals(0, response.getCookies().length);
	
	//测试存在cookie，登出后要清除cookie值。
	request = new MockHttpServletRequest();
	response = new MockHttpServletResponse();
	request.setCookies(new Cookie(WebConstants.KI4SO_SERVER_ENCRYPTED_CREDENTIAL_COOKIE_KEY, "dddsd"));
	logoutAction.logout(request, response);
	Assert.assertEquals(1, response.getCookies().length);
	Assert.assertEquals(0, response.getCookies()[0].getMaxAge());
}