### Question:
RetryPolicyAdapter implements com.ibm.cloud.objectstorage.retry.v2.RetryPolicy { @Override public boolean shouldRetry(RetryPolicyContext context) { return !maxRetriesExceeded(context) && isRetryable(context); } RetryPolicyAdapter(RetryPolicy legacyRetryPolicy, ClientConfiguration clientConfiguration); @Override long computeDelayBeforeNextRetry(RetryPolicyContext context); @Override boolean shouldRetry(RetryPolicyContext context); boolean isRetryable(RetryPolicyContext context); RetryPolicy getLegacyRetryPolicy(); boolean maxRetriesExceeded(RetryPolicyContext context);  }### Answer:
@Test public void shouldRetry_MaxErrorRetryReached() { assertFalse(adapter.shouldRetry(RetryPolicyContexts.withRetriesAttempted(3))); }
@Test public void shouldRetry_MaxErrorInClientConfigHonored_DoesNotUseMaxErrorInPolicy() { when(retryCondition.shouldRetry(any(AmazonWebServiceRequest.class), any(AmazonClientException.class), anyInt())) .thenReturn(true); legacyPolicy = new RetryPolicy(retryCondition, backoffStrategy, 3, true); adapter = new RetryPolicyAdapter(legacyPolicy, clientConfiguration); assertTrue(adapter.shouldRetry(RetryPolicyContexts.withRetriesAttempted(3))); assertFalse(adapter.shouldRetry(RetryPolicyContexts.withRetriesAttempted(10))); }
@Test public void shouldRetry_MaxErrorNotExceeded_DelegatesToLegacyRetryCondition() { final RetryPolicyContext context = RetryPolicyContexts.LEGACY; adapter.shouldRetry(context); verify(retryCondition).shouldRetry( eq((AmazonWebServiceRequest) context.originalRequest()), eq((AmazonClientException) context.exception()), eq(context.retriesAttempted())); }