@Test public void handle() throws Throwable { when( repository.readTransSharedObjects( any() ) ).thenReturn( mock( SharedObjects.class ) ); Method method = Repository.class.getMethod( "readTransSharedObjects", TransMeta.class ); sessionTimeoutHandler.handle( repository, mock( Exception.class ), method, new Object[] { mock( TransMeta.class ) } ); verify( sessionTimeoutHandler, never() ).showLoginScreen( any() ); }
public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } SessionTimeoutHandler( RepositoryConnectController repositoryConnectController ); }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } SessionTimeoutHandler( RepositoryConnectController repositoryConnectController ); Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ); }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } SessionTimeoutHandler( RepositoryConnectController repositoryConnectController ); Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args );  }