NamingExceptionRetryHandler extends ExceptionRetryHandler { @Override public Object perform() throws NamingException { try { return super.perform(); } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw ((NamingException) ex); } } NamingExceptionRetryHandler(Class<?>[] exceptionClasses, ExceptionRetryingProxy proxy,
            RetrySchedule schedule, int maxRetries); @Override Object perform(); @Override void postFailure(Exception ex, int retryCount); void postFailure(NamingException ex, int retryCount);  }
@Test void testPerform() throws NamingException { Object result = new NamingExceptionRetryHandler( exceptionClasses, proxy, schedule, 0) { @Override public Object operation() { return "Hi!"; } }.perform(); assertThat(result).isEqualTo("Hi!"); try { new NamingExceptionRetryHandler( exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { throw new NamingException(); } }.perform(); } catch (NamingException ex) { } assertThat(result).isEqualTo("Hi!"); }