@Test public void testInvokeOccurBusinessexception01() throws Throwable { BusinessException occurException = new BusinessException("testing businessexception"); when(mockMethodInvocation.proceed()).thenThrow(occurException); try { testTarget.invoke(mockMethodInvocation); fail("didn't occured BusinessException."); } catch (BusinessException e) { assertThat(e, is(occurException)); verify(mockExceptionLogger, times(1)).warn(occurException); verify(mockExceptionLogger, times(1)).warn(any(Exception.class)); } }
@Override public Object invoke( MethodInvocation invocation) throws Throwable, ResultMessagesNotificationException { if (startingPoint.get() == null) { startingPoint.set(invocation); } try { return invocation.proceed(); } catch (ResultMessagesNotificationException e) { if (isStartingPoint(invocation)) { logResultMessagesNotificationException(e); } throw e; } finally { if (isStartingPoint(invocation)) { startingPoint.remove(); } } }
ResultMessagesLoggingInterceptor implements MethodInterceptor,
                                              InitializingBean { @Override public Object invoke( MethodInvocation invocation) throws Throwable, ResultMessagesNotificationException { if (startingPoint.get() == null) { startingPoint.set(invocation); } try { return invocation.proceed(); } catch (ResultMessagesNotificationException e) { if (isStartingPoint(invocation)) { logResultMessagesNotificationException(e); } throw e; } finally { if (isStartingPoint(invocation)) { startingPoint.remove(); } } } }
ResultMessagesLoggingInterceptor implements MethodInterceptor,
                                              InitializingBean { @Override public Object invoke( MethodInvocation invocation) throws Throwable, ResultMessagesNotificationException { if (startingPoint.get() == null) { startingPoint.set(invocation); } try { return invocation.proceed(); } catch (ResultMessagesNotificationException e) { if (isStartingPoint(invocation)) { logResultMessagesNotificationException(e); } throw e; } finally { if (isStartingPoint(invocation)) { startingPoint.remove(); } } }  }
ResultMessagesLoggingInterceptor implements MethodInterceptor,
                                              InitializingBean { @Override public Object invoke( MethodInvocation invocation) throws Throwable, ResultMessagesNotificationException { if (startingPoint.get() == null) { startingPoint.set(invocation); } try { return invocation.proceed(); } catch (ResultMessagesNotificationException e) { if (isStartingPoint(invocation)) { logResultMessagesNotificationException(e); } throw e; } finally { if (isStartingPoint(invocation)) { startingPoint.remove(); } } }  void setExceptionLogger(ExceptionLogger exceptionLogger); @Override Object invoke(
            MethodInvocation invocation); @Override void afterPropertiesSet(); }
ResultMessagesLoggingInterceptor implements MethodInterceptor,
                                              InitializingBean { @Override public Object invoke( MethodInvocation invocation) throws Throwable, ResultMessagesNotificationException { if (startingPoint.get() == null) { startingPoint.set(invocation); } try { return invocation.proceed(); } catch (ResultMessagesNotificationException e) { if (isStartingPoint(invocation)) { logResultMessagesNotificationException(e); } throw e; } finally { if (isStartingPoint(invocation)) { startingPoint.remove(); } } }  void setExceptionLogger(ExceptionLogger exceptionLogger); @Override Object invoke(
            MethodInvocation invocation); @Override void afterPropertiesSet();  }