InsertRetryPolicy implements Serializable { public abstract boolean shouldRetry(Context context);  abstract boolean shouldRetry(Context context); static InsertRetryPolicy neverRetry(); static InsertRetryPolicy alwaysRetry(); static InsertRetryPolicy retryTransientErrors();  }
@Test public void testCustomRetryPolicy() { InsertRetryPolicy policy = new RetryAllExceptInvalidQuery(); assertTrue( policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "unavailable")))); assertTrue(policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "invalid")))); assertFalse( policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "invalidQuery")))); assertTrue( policy.shouldRetry(new Context(generateErrorAmongMany(5, "timeout", "notImplemented")))); }