From 9774b8e02940fb8018c63d58b2b5ea59937b94ff Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Thu, 14 Apr 2005 02:08:56 +0000 Subject: [PATCH] Improved setup to recover if the account already exists. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2481 b35dd754-fafc-0310-a699-88a17e54d16e --- test/org/jivesoftware/smack/test/SmackTestCase.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/org/jivesoftware/smack/test/SmackTestCase.java b/test/org/jivesoftware/smack/test/SmackTestCase.java index 9cb55b9f4..938416e80 100644 --- a/test/org/jivesoftware/smack/test/SmackTestCase.java +++ b/test/org/jivesoftware/smack/test/SmackTestCase.java @@ -58,6 +58,7 @@ import java.util.Enumeration; import javax.net.SocketFactory; import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.XMPPException; import org.xmlpull.v1.*; import org.xmlpull.mxp1.MXParser; @@ -227,7 +228,14 @@ public abstract class SmackTestCase extends TestCase { for (int i = 0; i < getMaxConnections(); i++) { // Create the test account - getConnection(i).getAccountManager().createAccount("user" + i, "user" + i); + try { + getConnection(i).getAccountManager().createAccount("user" + i, "user" + i); + } catch (XMPPException e) { + // Do nothing if the accout already exists + if (e.getXMPPError().getCode() != 409) { + throw e; + } + } // Login with the new test account getConnection(i).login("user" + i, "user" + i); }