Package org.springframework.security.web.savedrequest

Source Code of org.springframework.security.web.savedrequest.RequestCacheAwareFilterTests

package org.springframework.security.web.savedrequest;

import static org.junit.Assert.*;

import org.junit.Test;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

public class RequestCacheAwareFilterTests {

    @Test
    public void savedRequestIsRemovedAfterMatch() throws Exception {
        RequestCacheAwareFilter filter = new RequestCacheAwareFilter();
        HttpSessionRequestCache cache = new HttpSessionRequestCache();

        MockHttpServletRequest request = new MockHttpServletRequest("POST", "/destination");
        MockHttpServletResponse response = new MockHttpServletResponse();
        cache.saveRequest(request, response);
        assertNotNull(request.getSession().getAttribute(HttpSessionRequestCache.SAVED_REQUEST));

        filter.doFilter(request, response, new MockFilterChain());
        assertNull(request.getSession().getAttribute(HttpSessionRequestCache.SAVED_REQUEST));
    }
}
TOP

Related Classes of org.springframework.security.web.savedrequest.RequestCacheAwareFilterTests

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.