@Test(groups = {"jaggery"},
description = "Test a sample request and a response for E-mail host object")
public void testSendEmail() {
ClientConnectionUtil.waitForPort(9763);
GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP);
greenMail.start();
String finalOutput = null;
try {
URL jaggeryURL = new URL("http://localhost:9763/testapp/email.jag");
URLConnection jaggeryServerConnection = jaggeryURL.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
jaggeryServerConnection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
finalOutput = inputLine;
}
in.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
assertEquals(finalOutput, "email successfully sent");
greenMail.stop();
}
}