@Test public void testConfigureHandlerInterceptor() throws Exception { List<Object> interceptors = new ArrayList<Object>(); interceptors.add(new LoggingHandlerInterceptor()); reset(httpServer); expect(httpServer.getInterceptors()).andReturn(interceptors).once(); expect(httpServer.getEndpointAdapter()).andReturn(null).once(); expect(httpServer.getMessageConverter()).andReturn(new HttpMessageConverter()).once(); expect(httpServer.getWebSockets()).andReturn(new ArrayList<WebSocketEndpoint>()).once(); replay(httpServer); servlet.initStrategies(applicationContext); Assert.assertEquals(handlerInterceptor.getInterceptors().size(), 1L); Assert.assertEquals(handlerInterceptor.getInterceptors().get(0), interceptors.get(0)); Assert.assertNotNull(httpMessageController.getEndpointConfiguration().getMessageConverter()); Assert.assertEquals( httpMessageController.getEndpointAdapter().getClass(), EmptyResponseEndpointAdapter.class); verify(httpServer); }
@Test public void testConfigureMessageController() throws Exception { reset(httpServer); expect(httpServer.getInterceptors()).andReturn(null).once(); expect(httpServer.getEndpointAdapter()).andReturn(new TimeoutProducingEndpointAdapter()).once(); expect(httpServer.getMessageConverter()).andReturn(new HttpMessageConverter()).once(); expect(httpServer.getWebSockets()).andReturn(new ArrayList<WebSocketEndpoint>()).once(); replay(httpServer); servlet.initStrategies(applicationContext); Assert.assertEquals(handlerInterceptor.getInterceptors().size(), 0L); Assert.assertEquals( httpMessageController.getEndpointAdapter().getClass(), TimeoutProducingEndpointAdapter.class); Assert.assertNotNull(httpMessageController.getEndpointConfiguration().getMessageConverter()); verify(httpServer); }