|
17 | 17 |
|
18 | 18 | import static org.junit.Assert.assertEquals; |
19 | 19 | import static org.junit.Assert.assertFalse; |
| 20 | +import static org.junit.Assert.assertNotNull; |
20 | 21 | import static org.junit.Assert.assertNull; |
21 | 22 | import static org.junit.Assert.assertTrue; |
22 | 23 | import static org.junit.Assert.fail; |
|
36 | 37 | import com.amazonaws.services.simpleemail.model.ListIdentitiesResult; |
37 | 38 | import com.amazonaws.services.simpleemail.model.NotificationType; |
38 | 39 | import com.amazonaws.services.simpleemail.model.SetIdentityDkimEnabledRequest; |
| 40 | +import com.amazonaws.services.simpleemail.model.SetIdentityDkimEnabledResult; |
39 | 41 | import com.amazonaws.services.simpleemail.model.SetIdentityFeedbackForwardingEnabledRequest; |
40 | 42 | import com.amazonaws.services.simpleemail.model.SetIdentityNotificationTopicRequest; |
41 | 43 | import com.amazonaws.services.simpleemail.model.VerifyDomainDkimRequest; |
|
50 | 52 | import org.junit.Test; |
51 | 53 |
|
52 | 54 | import java.util.Date; |
| 55 | +import java.util.List; |
53 | 56 |
|
54 | 57 | public class IdentityIntegrationTest extends SESIntegrationTestBase { |
55 | 58 |
|
@@ -295,8 +298,7 @@ public void testIdentityFeedback() throws Exception { |
295 | 298 |
|
296 | 299 | // Flip Feedback forwarding |
297 | 300 | email.setIdentityFeedbackForwardingEnabled(new SetIdentityFeedbackForwardingEnabledRequest() |
298 | | - . |
299 | | - withIdentity(HUDSON_EMAIL_LIST).withForwardingEnabled(false)); |
| 301 | + .withIdentity(HUDSON_EMAIL_LIST).withForwardingEnabled(false)); |
300 | 302 |
|
301 | 303 | // verify state of attributes |
302 | 304 | attributes = email.getIdentityNotificationAttributes(getnot) |
@@ -344,23 +346,17 @@ public void testDkim() throws Exception { |
344 | 346 | assertTrue(attributes.getDkimVerificationStatus().equals("Pending")); |
345 | 347 | assertTrue(attributes.getDkimTokens().size() == dkim.getDkimTokens().size()); |
346 | 348 |
|
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)); |
357 | 352 |
|
358 | 353 | try { |
359 | | - email.setIdentityDkimEnabled(new SetIdentityDkimEnabledRequest() |
| 354 | + SetIdentityDkimEnabledResult setIdentityDkimEnabledResult = |
| 355 | + email.setIdentityDkimEnabled(new SetIdentityDkimEnabledRequest() |
360 | 356 | .withIdentity(testDomain)); |
361 | | - fail("Exception should have occurred during enable"); |
| 357 | + assertNotNull(setIdentityDkimEnabledResult); |
362 | 358 | } catch (AmazonServiceException exception) { |
363 | | - // exception expected |
| 359 | + fail("Exception encountered during enable"); |
364 | 360 | } |
365 | 361 | } finally { |
366 | 362 | // Delete domain from verified list. |
|
0 commit comments