]> WPIA git - gigi.git/commitdiff
Purging db before test kills its own users :-):
authorFelix Dörre <felix@dogcraft.de>
Sun, 28 Sep 2014 16:03:51 +0000 (18:03 +0200)
committerJanis Streib <janis@dogcraft.de>
Wed, 31 Dec 2014 01:35:42 +0000 (02:35 +0100)
tests/org/cacert/gigi/testUtils/PingTest.java

index 0a65ec51f44e734181b7c5969d3a4eb12f9b5c08..50d5d7fc14696a97692c39e8fb85b35ec8feb9ed 100644 (file)
@@ -16,7 +16,7 @@ import org.cacert.gigi.database.DatabaseConnection;
 import org.cacert.gigi.database.GigiPreparedStatement;
 import org.cacert.gigi.database.GigiResultSet;
 import org.cacert.gigi.pages.account.domain.DomainOverview;
-import org.junit.Before;
+import org.junit.After;
 
 public abstract class PingTest extends ClientTest {
 
@@ -50,7 +50,9 @@ public abstract class PingTest extends ClientTest {
         String newcontent = IOUtils.readURL(cookie(u.openConnection(), cookie));
         Pattern dlink = Pattern.compile(DomainOverview.PATH + "([0-9]+)'>");
         Matcher m1 = dlink.matcher(newcontent);
-        m1.find();
+        if ( !m1.find()) {
+            throw new Error(newcontent);
+        }
         URL u2 = new URL(u.toString() + m1.group(1));
         return u2;
     }
@@ -67,14 +69,8 @@ public abstract class PingTest extends ClientTest {
         return m;
     }
 
-    private static boolean first = true;
-
-    @Before
+    @After
     public void purgeDbAfterTest() throws SQLException, IOException {
-        if (first) {
-            first = false;
-            return;
-        }
         purgeDatabase();
     }