]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/TestUser.java
upd: refactor tests to use convenience get-stuff
[gigi.git] / tests / org / cacert / gigi / TestUser.java
index 9fd1fe7a331d3e63d0a5c50571be67af7a5c8191..1124179ac4bc3998a997d0e7d14a7e2fa982beff 100644 (file)
@@ -2,6 +2,7 @@ package org.cacert.gigi;
 
 import static org.junit.Assert.*;
 
+import java.io.IOException;
 import java.sql.Date;
 import java.sql.SQLException;
 import java.util.Locale;
@@ -58,16 +59,18 @@ public class TestUser extends ManagedTest {
     }
 
     @Test
-    public void testMatcherMethods() throws SQLException, GigiApiException {
+    public void testMatcherMethods() throws SQLException, GigiApiException, IOException {
         String uq = createUniqueName();
         int id = createVerifiedUser("aä", "b", uq + "a@email.org", TEST_PASSWORD);
 
         User u = User.getById(id);
         new EmailAddress(u, uq + "b@email.org", Locale.ENGLISH);
+        getMailReciever().receive().verify();
         new EmailAddress(u, uq + "c@email.org", Locale.ENGLISH);
-        new Domain(u, uq + "a-testdomain.org");
-        new Domain(u, uq + "b-testdomain.org");
-        new Domain(u, uq + "c-testdomain.org");
+        getMailReciever().receive();// no-verify
+        verify(new Domain(u, u, uq + "a-testdomain.org"));
+        verify(new Domain(u, u, uq + "b-testdomain.org"));
+        verify(new Domain(u, u, uq + "c-testdomain.org"));
         assertEquals(3, u.getEmails().length);
         assertEquals(3, u.getDomains().length);
         assertTrue(u.isValidDomain(uq + "a-testdomain.org"));
@@ -82,6 +85,7 @@ public class TestUser extends ManagedTest {
         assertTrue(u.isValidEmail(uq + "b@email.org"));
         assertFalse(u.isValidEmail(uq + "b+6@email.org"));
         assertFalse(u.isValidEmail(uq + "b*@email.org"));
+        assertFalse(u.isValidEmail(uq + "c@email.org"));
 
         assertTrue(u.isValidName("aä b"));
         assertFalse(u.isValidName("aä c"));
@@ -117,7 +121,7 @@ public class TestUser extends ManagedTest {
     @Test
     public void testNoCats() {
         String email = createUniqueName() + "a@email.org";
-        int id = createVerifiedUser("aä", "b", email, TEST_PASSWORD);
+        createVerifiedUser("aä", "b", email, TEST_PASSWORD);
         User emailUser = User.getByEmail(email);
         assertFalse(emailUser.hasPassedCATS());
     }