@Test public void testafterPropertiesSet() throws Throwable { testTarget = new HandlerExceptionResolverLoggingInterceptor(); testTarget.afterPropertiesSet(); this.mockExceptionLogger = spy(testTarget.getExceptionLogger()); testTarget.setExceptionLogger(mockExceptionLogger); NullPointerException occurException = new NullPointerException("null pointer exception."); HttpServletResponse mockResponse = mock(HttpServletResponse.class); ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver(); when(mockMethodInvocation.proceed()).thenReturn("viewname"); when(mockMethodInvocation.getThis()).thenReturn(resolver); when(mockResponse.getStatus()).thenReturn(100); when(mockMethodInvocation.getArguments()).thenReturn(new Object[] { null, mockResponse, null, occurException }); testTarget.invoke(mockMethodInvocation); verify(mockExceptionLogger, times(1)).info((Exception) any()); }
@Override public void afterPropertiesSet() throws Exception { if (exceptionLogger == null) { exceptionLogger = new ExceptionLogger(getClass().getName()); exceptionLogger.afterPropertiesSet(); } }
HandlerExceptionResolverLoggingInterceptor implements
                                                        MethodInterceptor,
                                                        InitializingBean { @Override public void afterPropertiesSet() throws Exception { if (exceptionLogger == null) { exceptionLogger = new ExceptionLogger(getClass().getName()); exceptionLogger.afterPropertiesSet(); } } }
HandlerExceptionResolverLoggingInterceptor implements
                                                        MethodInterceptor,
                                                        InitializingBean { @Override public void afterPropertiesSet() throws Exception { if (exceptionLogger == null) { exceptionLogger = new ExceptionLogger(getClass().getName()); exceptionLogger.afterPropertiesSet(); } } HandlerExceptionResolverLoggingInterceptor(); }
HandlerExceptionResolverLoggingInterceptor implements
                                                        MethodInterceptor,
                                                        InitializingBean { @Override public void afterPropertiesSet() throws Exception { if (exceptionLogger == null) { exceptionLogger = new ExceptionLogger(getClass().getName()); exceptionLogger.afterPropertiesSet(); } } HandlerExceptionResolverLoggingInterceptor(); void setExceptionLogger(ExceptionLogger exceptionLogger); void setIgnoreExceptions(
            Set<Class<? extends Exception>> ignoreExceptions); @Override Object invoke(MethodInvocation invocation); @Override void afterPropertiesSet(); }
HandlerExceptionResolverLoggingInterceptor implements
                                                        MethodInterceptor,
                                                        InitializingBean { @Override public void afterPropertiesSet() throws Exception { if (exceptionLogger == null) { exceptionLogger = new ExceptionLogger(getClass().getName()); exceptionLogger.afterPropertiesSet(); } } HandlerExceptionResolverLoggingInterceptor(); void setExceptionLogger(ExceptionLogger exceptionLogger); void setIgnoreExceptions(
            Set<Class<? extends Exception>> ignoreExceptions); @Override Object invoke(MethodInvocation invocation); @Override void afterPropertiesSet();  }