CitrusDispatcherServlet extends DispatcherServlet { protected void configureMessageController(ApplicationContext context) { if (context.containsBean(MESSAGE_CONTROLLER_BEAN_NAME)) { HttpMessageController messageController = context.getBean(MESSAGE_CONTROLLER_BEAN_NAME, HttpMessageController.class); EndpointAdapter endpointAdapter = httpServer.getEndpointAdapter(); HttpEndpointConfiguration endpointConfiguration = new HttpEndpointConfiguration(); endpointConfiguration.setMessageConverter(httpServer.getMessageConverter()); endpointConfiguration.setHeaderMapper(DefaultHttpHeaderMapper.inboundMapper()); endpointConfiguration.setHandleAttributeHeaders(httpServer.isHandleAttributeHeaders()); endpointConfiguration.setHandleCookies(httpServer.isHandleCookies()); endpointConfiguration.setDefaultStatusCode(httpServer.getDefaultStatusCode()); messageController.setEndpointConfiguration(endpointConfiguration); if (endpointAdapter != null) { messageController.setEndpointAdapter(endpointAdapter); } } } CitrusDispatcherServlet(HttpServer httpServer);   }
@Test public void testConfigureMessageController() throws Exception { reset(httpServer); when(httpServer.getInterceptors()).thenReturn(null); when(httpServer.getEndpointAdapter()).thenReturn(new TimeoutProducingEndpointAdapter()); when(httpServer.isHandleAttributeHeaders()).thenReturn(true); when(httpServer.isHandleCookies()).thenReturn(true); when(httpServer.getMessageConverter()).thenReturn(new HttpMessageConverter()); servlet.initStrategies(applicationContext); Assert.assertEquals(handlerInterceptor.getInterceptors().size(), 1L); Assert.assertEquals(handlerInterceptor.getInterceptors().get(0).getClass(), LoggingHandlerInterceptor.class); Assert.assertEquals(httpMessageController.getEndpointAdapter().getClass(), TimeoutProducingEndpointAdapter.class); Assert.assertNotNull(httpMessageController.getEndpointConfiguration().getMessageConverter()); Assert.assertTrue(httpMessageController.getEndpointConfiguration().isHandleAttributeHeaders()); Assert.assertTrue(httpMessageController.getEndpointConfiguration().isHandleCookies()); }