ServiceRetrier implements ServiceWrapper { public void setMaxTries(int maxTries) { if (maxTries < 1) throw new IllegalArgumentException("Maximum number of tries must be greater than zero"); this._maxTries = maxTries; } ServiceRetrier(int delay, int maxTries);  ServiceRetrier(int delay, int maxTries,
            boolean doubleDelay, boolean throwCauseException, Class<? extends Throwable>[] retryOn);  ServiceRetrier(); V invoke(Callable<V> c); void invoke(Runnable r); T invoke(Runnable r, T result); int getDelay(); void setDelay(int delay); int getMaxTries(); void setMaxTries(int maxTries); boolean isDoubleDelay(); void setDoubleDelay(boolean doubleDelay); boolean isThrowCauseException(); void setThrowCauseException(boolean throwCauseException); Class<? extends Throwable>[] getRetryOn(); void setRetryOn(Class<? extends Throwable>[] retryOn); static final int DEFAULT_MAX_TRIES; static final int DEFAULT_DELAY; }
@Test(expected=IllegalArgumentException.class) public void testMaxTriesLessThanOneThrowsException() throws Exception { ServiceRetrier retrier = new ServiceRetrier(); retrier.setMaxTries(-1); }