JAMES-2352 Enhance a bit NamingExceptionRetryHandlerTest
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/414f3e64 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/414f3e64 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/414f3e64 Branch: refs/heads/master Commit: 414f3e649853a82753575d02c4056f60b14b2872 Parents: ff4d0b0 Author: benwa <btell...@linagora.com> Authored: Thu Mar 15 09:46:20 2018 +0700 Committer: Matthieu Baechler <matth...@apache.org> Committed: Fri Mar 16 11:12:50 2018 +0100 ---------------------------------------------------------------------- .../naming/NamingExceptionRetryHandlerTest.java | 41 ++++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/414f3e64/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java index 4b96735..7e0bd34 100644 --- a/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java +++ b/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java @@ -31,24 +31,9 @@ import org.apache.james.util.retry.api.RetrySchedule; import org.junit.Before; import org.junit.Test; -/** - * <code>ExceptionRetryHandlerTest</code> - */ public class NamingExceptionRetryHandlerTest { - private Class<?>[] exceptionClasses = null; - private ExceptionRetryingProxy proxy = null; - private RetrySchedule schedule = null; - - @Before - public void setUp() throws Exception { - exceptionClasses = new Class<?>[]{NamingException.class}; - proxy = new TestRetryingProxy(); - schedule = new TestRetrySchedule(); - } - - private class TestRetryingProxy implements ExceptionRetryingProxy { - + private static class TestRetryingProxy implements ExceptionRetryingProxy { @Override public Context getDelegate() { return null; @@ -64,19 +49,19 @@ public class NamingExceptionRetryHandlerTest { } } - private class TestRetrySchedule implements RetrySchedule { + private Class<?>[] exceptionClasses; + private ExceptionRetryingProxy proxy; + private RetrySchedule schedule; - @Override - public long getInterval(int index) { - return index; - } + @Before + public void setUp() throws Exception { + exceptionClasses = new Class<?>[]{NamingException.class}; + proxy = new TestRetryingProxy(); + schedule = i -> i; } - /** - * Test method for . - */ @Test - public final void testExceptionRetryHandler() { + public void testExceptionRetryHandler() { assertTrue(RetryHandler.class.isAssignableFrom(new NamingExceptionRetryHandler( exceptionClasses, proxy, schedule, 0) { @@ -87,12 +72,8 @@ public class NamingExceptionRetryHandlerTest { }.getClass())); } - /** - * Test method for . - * @throws Exception - */ @Test - public final void testPerform() throws NamingException { + public void testPerform() throws NamingException { Object result = new NamingExceptionRetryHandler( exceptionClasses, proxy, schedule, 0) { --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org