@Test public void storeReceivedEmail() throws Exception { sendMail(TO_ADDRESS, FROM_ADDRESS, MAIL_SUBJECT, MAIL_BODY); emailSteps.storeReceivedEmail(TO_ADDRESS, EMAIL_KEY); String emailContent = (String) propertyStore.get(EMAIL_KEY); assertThat(MAIL_BODY, is(emailContent)); }
@And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") public void storeReceivedEmail(String address, String propertyKey) throws Exception { String resolvedAddress = placeholderResolver.resolve(address); for (WiserMessage message : smtpServer.getMessages()) { if (message.getEnvelopeReceiver().equals(resolvedAddress)) { propertyStore.put(propertyKey, getCompleteContent(message.getMimeMessage())); return; } } fail("No message was found for " + address); }
EmailSteps { @And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") public void storeReceivedEmail(String address, String propertyKey) throws Exception { String resolvedAddress = placeholderResolver.resolve(address); for (WiserMessage message : smtpServer.getMessages()) { if (message.getEnvelopeReceiver().equals(resolvedAddress)) { propertyStore.put(propertyKey, getCompleteContent(message.getMimeMessage())); return; } } fail("No message was found for " + address); } }
EmailSteps { @And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") public void storeReceivedEmail(String address, String propertyKey) throws Exception { String resolvedAddress = placeholderResolver.resolve(address); for (WiserMessage message : smtpServer.getMessages()) { if (message.getEnvelopeReceiver().equals(resolvedAddress)) { propertyStore.put(propertyKey, getCompleteContent(message.getMimeMessage())); return; } } fail("No message was found for " + address); } EmailSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver); }
EmailSteps { @And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") public void storeReceivedEmail(String address, String propertyKey) throws Exception { String resolvedAddress = placeholderResolver.resolve(address); for (WiserMessage message : smtpServer.getMessages()) { if (message.getEnvelopeReceiver().equals(resolvedAddress)) { propertyStore.put(propertyKey, getCompleteContent(message.getMimeMessage())); return; } } fail("No message was found for " + address); } EmailSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver); @Before("@emailing") void startUpServer(); @Then("^" + Phrases.SUBJECT + " should receive an email containing subject (.+) for (.+)$") void userShouldReceiveEmailWithSubject(String subject, String address); @Then("^" + Phrases.SUBJECT + " should receive an email for (.+)$") void userShouldReceiveEmail(String address); @And("^the email containing subject (.+) for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") void storeReceivedEmailWithSubject(String subject, String address, String propertyKey); @And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") void storeReceivedEmail(String address, String propertyKey); @After("@emailing") void stopServer(); }
EmailSteps { @And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") public void storeReceivedEmail(String address, String propertyKey) throws Exception { String resolvedAddress = placeholderResolver.resolve(address); for (WiserMessage message : smtpServer.getMessages()) { if (message.getEnvelopeReceiver().equals(resolvedAddress)) { propertyStore.put(propertyKey, getCompleteContent(message.getMimeMessage())); return; } } fail("No message was found for " + address); } EmailSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver); @Before("@emailing") void startUpServer(); @Then("^" + Phrases.SUBJECT + " should receive an email containing subject (.+) for (.+)$") void userShouldReceiveEmailWithSubject(String subject, String address); @Then("^" + Phrases.SUBJECT + " should receive an email for (.+)$") void userShouldReceiveEmail(String address); @And("^the email containing subject (.+) for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") void storeReceivedEmailWithSubject(String subject, String address, String propertyKey); @And("^the email for (.+) is stored as " + Phrases.PROPERTY_KEY + "$") void storeReceivedEmail(String address, String propertyKey); @After("@emailing") void stopServer(); final static String SMTP_PORT; }