Skip to content

Commit f54fa39

Browse files
authored
Change failure assertion during setIdentityDkimEnabled (#969)
* Change failure assertion during setIdentityDkimEnabled
1 parent e5fa745 commit f54fa39

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

aws-android-sdk-ses-test/src/androidTest/java/com/amazonaws/services/email/IdentityIntegrationTest.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static org.junit.Assert.assertEquals;
1919
import static org.junit.Assert.assertFalse;
20+
import static org.junit.Assert.assertNotNull;
2021
import static org.junit.Assert.assertNull;
2122
import static org.junit.Assert.assertTrue;
2223
import static org.junit.Assert.fail;
@@ -36,6 +37,7 @@
3637
import com.amazonaws.services.simpleemail.model.ListIdentitiesResult;
3738
import com.amazonaws.services.simpleemail.model.NotificationType;
3839
import com.amazonaws.services.simpleemail.model.SetIdentityDkimEnabledRequest;
40+
import com.amazonaws.services.simpleemail.model.SetIdentityDkimEnabledResult;
3941
import com.amazonaws.services.simpleemail.model.SetIdentityFeedbackForwardingEnabledRequest;
4042
import com.amazonaws.services.simpleemail.model.SetIdentityNotificationTopicRequest;
4143
import com.amazonaws.services.simpleemail.model.VerifyDomainDkimRequest;
@@ -50,6 +52,7 @@
5052
import org.junit.Test;
5153

5254
import java.util.Date;
55+
import java.util.List;
5356

5457
public class IdentityIntegrationTest extends SESIntegrationTestBase {
5558

@@ -295,8 +298,7 @@ public void testIdentityFeedback() throws Exception {
295298

296299
// Flip Feedback forwarding
297300
email.setIdentityFeedbackForwardingEnabled(new SetIdentityFeedbackForwardingEnabledRequest()
298-
.
299-
withIdentity(HUDSON_EMAIL_LIST).withForwardingEnabled(false));
301+
.withIdentity(HUDSON_EMAIL_LIST).withForwardingEnabled(false));
300302

301303
// verify state of attributes
302304
attributes = email.getIdentityNotificationAttributes(getnot)
@@ -344,23 +346,17 @@ public void testDkim() throws Exception {
344346
assertTrue(attributes.getDkimVerificationStatus().equals("Pending"));
345347
assertTrue(attributes.getDkimTokens().size() == dkim.getDkimTokens().size());
346348

347-
for (String token1 : attributes.getDkimTokens()) {
348-
boolean found = false;
349-
for (String token2 : dkim.getDkimTokens()) {
350-
if (token1.equals(token2)) {
351-
found = true;
352-
break;
353-
}
354-
}
355-
assertTrue(found);
356-
}
349+
List verifyDomainResultTokens = dkim.getDkimTokens();
350+
List attributeTokens = attributes.getDkimTokens();
351+
assertTrue(verifyDomainResultTokens.containsAll(attributeTokens));
357352

358353
try {
359-
email.setIdentityDkimEnabled(new SetIdentityDkimEnabledRequest()
354+
SetIdentityDkimEnabledResult setIdentityDkimEnabledResult =
355+
email.setIdentityDkimEnabled(new SetIdentityDkimEnabledRequest()
360356
.withIdentity(testDomain));
361-
fail("Exception should have occurred during enable");
357+
assertNotNull(setIdentityDkimEnabledResult);
362358
} catch (AmazonServiceException exception) {
363-
// exception expected
359+
fail("Exception encountered during enable");
364360
}
365361
} finally {
366362
// Delete domain from verified list.

0 commit comments

Comments
 (0)