Skip to content
Snippets Groups Projects
Commit b28a1a90 authored by felmer's avatar felmer
Browse files

making all system tests which are subclasses of ObjectsImportTest more robust...

making all system tests which are subclasses of ObjectsImportTest more robust by waiting one second before finding the latest email (in case of async execution)
parent 4a4cdaf8
No related branches found
No related tags found
No related merge requests found
...@@ -233,18 +233,30 @@ public class ObjectsImportTest extends AbstractFileTest ...@@ -233,18 +233,30 @@ public class ObjectsImportTest extends AbstractFileTest
protected void assertNoEmails(long timestamp) protected void assertNoEmails(long timestamp)
{ {
Email latestEmail = EmailUtil.findLatestEmail(); Email latestEmail = waitAndFindLatestEmail();
assertTrue("Timestamp: " + timestamp + ", Latest email: " + latestEmail, latestEmail == null || latestEmail.timestamp < timestamp); assertTrue("Timestamp: " + timestamp + ", Latest email: " + latestEmail, latestEmail == null || latestEmail.timestamp < timestamp);
} }
protected void assertEmail(long timestamp, String expectedEmail, String expectedSubject) protected void assertEmail(long timestamp, String expectedEmail, String expectedSubject)
{ {
Email latestEmail = EmailUtil.findLatestEmail(); Email latestEmail = waitAndFindLatestEmail();
assertTrue("Timestamp: " + timestamp + ", Latest email: " + latestEmail, latestEmail != null && latestEmail.timestamp >= timestamp); assertTrue("Timestamp: " + timestamp + ", Latest email: " + latestEmail, latestEmail != null && latestEmail.timestamp >= timestamp);
assertEquals(expectedEmail, latestEmail.to); assertEquals(expectedEmail, latestEmail.to);
assertTrue(latestEmail.subject, latestEmail.subject.contains(expectedSubject)); assertTrue(latestEmail.subject, latestEmail.subject.contains(expectedSubject));
} }
private Email waitAndFindLatestEmail()
{
try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{
// silently ignored
}
return EmailUtil.findLatestEmail();
}
public static class ImportFile public static class ImportFile
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment