RetryUtils { public static boolean isThrottlingException(SdkBaseException exception) { return isAse(exception) && isThrottlingException(toAse(exception)); }  static boolean isRetryableServiceException(SdkBaseException exception); static boolean isRetryableServiceException(AmazonServiceException exception); static boolean isThrottlingException(SdkBaseException exception); static boolean isThrottlingException(AmazonServiceException exception); static boolean isRequestEntityTooLargeException(SdkBaseException exception); static boolean isRequestEntityTooLargeException(AmazonServiceException exception); static boolean isClockSkewError(SdkBaseException exception); static boolean isClockSkewError(AmazonServiceException exception);  }
@Test public void isThrottlingException_TrueWhenErrorCodeMatchesKnownCodes() throws Exception { AmazonServiceException ase = new AmazonServiceException("msg"); ase.setErrorCode("ThrottlingException"); assertTrue("ThrottlingException error code should be true", RetryUtils.isThrottlingException(ase)); }
@Test public void isThrottlingException_TrueWhenStatusCodeIs429() throws Exception { AmazonServiceException ase = new AmazonServiceException("msg"); ase.setStatusCode(429); assertTrue("ThrottlingException error code should be true", RetryUtils.isThrottlingException(ase)); }
@Test public void isThrottlingException_FalseWhenErrorAndStatusCodeDoNotMatch() throws Exception { AmazonServiceException ase = new AmazonServiceException("msg"); ase.setStatusCode(500); ase.setErrorCode("InternalFailure"); assertFalse("InternalFailure error code should be false", RetryUtils.isThrottlingException(ase)); }
@Test public void isThrottlingExceptions_True_When_EC2ThrottledException() { AmazonServiceException ase = new AmazonServiceException("msg"); ase.setErrorCode("EC2ThrottledException"); assertTrue(RetryUtils.isThrottlingException(ase)); }