]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/testUtils/ManagedTest.java
Fix: a bug that caused regression tests to hang.
[gigi.git] / tests / org / cacert / gigi / testUtils / ManagedTest.java
index 4c3a8c9de640fdd9e6d0fcb249958f29d7c07d5b..d9fb31e77fa2168dbc0e82cb642998f61aeff4d5 100644 (file)
@@ -53,6 +53,7 @@ import org.cacert.gigi.util.ServerConstants;
 import org.cacert.gigi.util.SimpleSigner;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 
 /**
@@ -104,6 +105,7 @@ public class ManagedTest extends ConfiguredTest {
                 url = testProps.getProperty("name.www") + ":" + testProps.getProperty("serverPort.https");
                 String[] parts = testProps.getProperty("mail").split(":", 2);
                 ter = new TestEmailReciever(new InetSocketAddress(parts[0], Integer.parseInt(parts[1])));
+                ter.start();
                 return;
             }
             url = testProps.getProperty("name.www") + ":" + testProps.getProperty("serverPort.https");
@@ -139,6 +141,7 @@ public class ManagedTest extends ConfiguredTest {
                 throw new Error("Server startup failed");
             }
             ter = new TestEmailReciever(new InetSocketAddress("localhost", 8473));
+            ter.start();
             SimpleSigner.runSigner();
         } catch (IOException e) {
             throw new Error(e);
@@ -277,6 +280,7 @@ public class ManagedTest extends ConfiguredTest {
         registerUser(firstName, lastName, email, password);
         try {
             TestMail tm = ter.recieve();
+            Assert.assertNotNull(tm);
             tm.verify();
             GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id FROM users where email=?");
             ps.setString(1, email);
@@ -468,6 +472,7 @@ public class ManagedTest extends ConfiguredTest {
         EmailAddress adrr = new EmailAddress(u, createUniqueName() + "test@test.tld");
         adrr.insert(Language.getInstance(Locale.ENGLISH));
         TestMail testMail = getMailReciever().recieve();
+        Assert.assertNotNull(testMail);
         assertEquals(adrr.getAddress(), testMail.getTo());
         String hash = testMail.extractLink().substring(testMail.extractLink().lastIndexOf('=') + 1);
         adrr.verify(hash);