Hi Everyone,

Ive been having a play the spring-test-mvc library and very impressed with it. I have one small issue in which I was hoping someone could help?

Im using mockito and am having problems with the MockHttpServletRequest.

My unit test

Code:
DefaultRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/service/transactionKey")				
			.header("Client-IP-Address", "192.168.0.1")
			.requestAttr("Application-Context", "something");
				
		MockHttpServletRequest request = requestBuilder.buildRequest(wac.getServletContext());
		
		when(requestHelper.getApplicationContext(request)).thenReturn(productApplicationContext);
		
		MvcResult mvcResult = mockMvc.perform(requestBuilder)
			.andDo(print())
			.andReturn();
My issue is that mockito never matches the mocked request in the controller and returns null.
Code:
when(requestHelper.getApplicationContext(request)).thenReturn(productApplicationContext);
I would like it to return the productApplicationContext mocked object.

In my controller I have

Code:
@ResponseBody
	public Response createTransactionKey(final HttpServletRequest request) {
		
		final ProductApplicationContext applContext = requestHelper.getApplicationContext(request);
Can anyone kindly give some advise? It appears the request in my unit test is not the request that the controllers receives.