Skip to content

Commit 29e1869

Browse files
authored
Add smoketest for ambgious error resolution (#6221)
1 parent ded8e6a commit 29e1869

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.services.cloudwatch;
17+
18+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
19+
20+
import java.io.IOException;
21+
import org.junit.AfterClass;
22+
import org.junit.BeforeClass;
23+
import org.junit.Test;
24+
import software.amazon.awssdk.regions.Region;
25+
import software.amazon.awssdk.services.cloudwatch.model.DashboardNotFoundErrorException;
26+
import software.amazon.awssdk.testutils.service.AwsIntegrationTestBase;
27+
28+
public class SmokeIntegrationTest extends AwsIntegrationTestBase {
29+
private static CloudWatchClient cloudwatch;
30+
31+
@BeforeClass
32+
public static void setUp() throws IOException {
33+
cloudwatch = CloudWatchClient.builder()
34+
.credentialsProvider(getCredentialsProvider())
35+
.region(Region.US_WEST_2)
36+
.build();
37+
}
38+
39+
@AfterClass
40+
public static void teardown() {
41+
cloudwatch.close();
42+
}
43+
44+
@Test
45+
public void test_AmbiguousErrorResolution() {
46+
assertThatThrownBy(() -> {
47+
cloudwatch.getDashboard(r -> r.dashboardName("foo"));
48+
}).isInstanceOf(DashboardNotFoundErrorException.class)
49+
.matches(e -> {
50+
DashboardNotFoundErrorException dnf = (DashboardNotFoundErrorException) e;
51+
return "ResourceNotFound".equals(dnf.awsErrorDetails().errorCode());
52+
});
53+
}
54+
}

0 commit comments

Comments
 (0)