@Test
  public void testNewRetryStrategyBuilder() {
    // custom validator that only approves strategies where initialbackoff == 30s
    when(validator.validate(any(RetryStrategy.class)))
        .thenAnswer(
            new Answer<List<String>>() {
              @Override
              public List<String> answer(InvocationOnMock invocation) throws Throwable {
                RetryStrategy rs = (RetryStrategy) invocation.getArguments()[0];
                // only succeed if initialBackoff == 30s
                return rs.getInitialBackoff() == 30 ? null : Arrays.asList("foo", "bar");
              }
            });

    try {
      dispatcher.newRetryStrategy(RetryStrategy.RETRY_POLICY_EXPONENTIAL, 0, 30);
      fail("Expected initial backoff != 30s to fail using custom validator");
    } catch (Exception unused) {
      /* unused */
    }

    try {
      dispatcher.newRetryStrategy(RetryStrategy.RETRY_POLICY_EXPONENTIAL, 30, 30);
    } catch (Exception e) {
      throw new AssertionError(
          "Expected initial backoff == 30s not to fail using custom validator", e);
    }
  }
Tests for the {@link FirebaseJobDispatcher} class.
jobdispatcher/src/test/java/com/firebase/jobdispatcher/FirebaseJobDispatcherTest.java