Skip to content

Commit 537677b

Browse files
author
Colman Yau
committed
Add test for covering ClientErrorsNotCausedByAbortedException
1 parent f05c8d8 commit 537677b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

aws-codeguruprofiler-profilinggroup/src/test/java/software/amazon/codeguruprofiler/profilinggroup/CodeGuruProfilerClientConfigurationTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
import software.amazon.awssdk.core.exception.SdkException;
1111
import software.amazon.awssdk.core.retry.RetryPolicyContext;
1212
import software.amazon.awssdk.core.retry.conditions.RetryCondition;
13+
import software.amazon.awssdk.services.codeguruprofiler.model.ConflictException;
1314

1415
import static org.assertj.core.api.Assertions.assertThat;
1516

1617
@ExtendWith(MockitoExtension.class)
17-
class CodeGuruProfilerClientConfigurationTest {
18+
public class CodeGuruProfilerClientConfigurationTest {
1819

1920
@Nested
2021
class DescribeRetryCondition {
@@ -23,15 +24,18 @@ public void itShouldNotRetryClientErrorsByDefault() {
2324
assertThat(getRetryCondition().shouldRetry(createRetryContext(SdkClientException.create("test")))).isFalse();
2425
}
2526

27+
@Test
28+
public void itShouldNotRetryErrorsWhenClientErrorsNotCausedByAbortedException() {
29+
SdkClientException clientException =
30+
SdkClientException.create("test", ConflictException.builder().build());
31+
assertThat(getRetryCondition().shouldRetry(createRetryContext(clientException))).isFalse();
32+
}
33+
2634
@Test
2735
public void itShouldRetryClientErrorsCausedByAbortedException() {
2836
// Until https://github.com/aws/aws-sdk-java-v2/issues/1684 is fixed
2937
SdkClientException clientException =
30-
SdkClientException.builder()
31-
.message("test")
32-
.cause(AbortedException.create("test aborted exception"))
33-
.build();
34-
38+
SdkClientException.create("test", AbortedException.create("test aborted exception"));
3539
assertThat(getRetryCondition().shouldRetry(createRetryContext(clientException))).isTrue();
3640
}
3741
}

0 commit comments

Comments
 (0)