Skip to content

Commit 23c8cb6

Browse files
authored
Fix IoT assertion during integ test setup (#1095)
1 parent 0da812c commit 23c8cb6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

aws-android-sdk-iot/src/androidTest/java/com/amazonaws/mobileconnectors/iot/MqttManagerIntegrationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.amazonaws.services.iot.model.DescribeEndpointRequest;
3737
import com.amazonaws.services.iot.model.DescribeEndpointResult;
3838
import com.amazonaws.services.iot.model.DetachPolicyRequest;
39+
import com.amazonaws.services.iot.model.ResourceAlreadyExistsException;
3940
import com.amazonaws.services.iot.model.UpdateCertificateRequest;
4041

4142
import org.junit.After;
@@ -1124,8 +1125,7 @@ private void createAndAttachPolicy() {
11241125
createPolicyRequest.setPolicyDocument(policyDocument);
11251126
this.createPolicyResult = iotClient.createPolicy(createPolicyRequest);
11261127
} catch (Exception ex) {
1127-
assertTrue("Error in creating the policy. ",
1128-
ex.getMessage().startsWith("Policy cannot be created - name already exists "));
1128+
assertEquals(ex.getClass(), ResourceAlreadyExistsException.class);
11291129
}
11301130

11311131
AttachPolicyRequest attachPolicyRequest = new AttachPolicyRequest();
@@ -1135,13 +1135,13 @@ private void createAndAttachPolicy() {
11351135
}
11361136

11371137
/**
1138-
* Detatch the policy from the certificate.
1138+
* Detach the policy from the certificate.
11391139
* Delete the policy.
11401140
* Update certificate status as inactive.
11411141
* Delete the certificate.
11421142
*/
11431143
private void deletePolicyAndCertificate() {
1144-
Log.d(TAG, "Detatching the policy from the certificate.");
1144+
Log.d(TAG, "Detaching the policy from the certificate.");
11451145
DetachPolicyRequest detachPolicyRequest = new DetachPolicyRequest();
11461146
detachPolicyRequest.setPolicyName(IOT_POLICY_NAME);
11471147
detachPolicyRequest.setTarget(this.certResult.getCertificateArn());

0 commit comments

Comments
 (0)