use of com.thoughtworks.go.utils.Pop3MailClient in project gocd by gocd.
the class Pop3Matchers method emailCount.
public static TypeSafeMatcher<Pop3MailClient> emailCount(final String subject, int count) {
return new TypeSafeMatcher<Pop3MailClient>() {
private String errorMessage = "";
public boolean matchesSafely(Pop3MailClient client) {
try {
Message message = client.findMessageWithSubject(subject);
boolean b = message != null;
if (b) {
errorMessage = "No message";
}
return b;
} catch (Exception e) {
errorMessage = e.getMessage();
return false;
}
}
public void describeTo(Description description) {
description.appendText(String.format("Expected to find message with subject [%s], but got error: %s", subject, errorMessage));
}
};
}
use of com.thoughtworks.go.utils.Pop3MailClient in project gocd by gocd.
the class EmailMatchers method emailSubjectContains.
public static TypeSafeMatcher<Pop3MailClient> emailSubjectContains(final String subject) {
return new TypeSafeMatcher<Pop3MailClient>() {
private String errorMessage = "";
public boolean matchesSafely(Pop3MailClient client) {
try {
Message message = client.findMessageWithSubject(subject);
boolean found = message != null;
if (!found) {
errorMessage = "No message";
}
return found;
} catch (Exception e) {
errorMessage = e.getMessage();
return false;
}
}
public void describeTo(Description description) {
description.appendText(String.format("Expected to find message with subject [%s], but got error: %s", subject, errorMessage));
}
};
}
Aggregations