Code example for ServletWebRequest

0
 
	@Before 
	public void setup() { 
		interceptor = new TwitterConnectInterceptor(); 
		httpServletRequest = new MockHttpServletRequest(); 
		request = new ServletWebRequest(httpServletRequest); 
	} 
 
	@Test 
	public void preConnect() { 
		httpServletRequest.setParameter("postTweet", "true"); 
		interceptor.preConnect(null, null, request); 
		Boolean postTweetAttributeValue = (Boolean) request.getAttribute("twitterConnect.postTweet", WebRequest.SCOPE_SESSION); 
		assertNotNull(postTweetAttributeValue); 
		assertTrue(postTweetAttributeValue); 
	} 
 
	@Test 
	public void preConnect_noPostTweetParameter() { 
		interceptor.preConnect(null, null, request);