/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.slick.protocol.icq;

import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.protocol.event.RegistrationStateChangeListener;
import net.java.sip.communicator.service.protocol.event.RegistrationStateChangeEvent;
import net.java.sip.communicator.util.Logger;

/**
 * Phoney tests to signal specific problems with the
 * accounts.properties file
 * @author Brian Burch
 */
public class TestAccountInvalidNotification extends TestCase
{
    private static final Logger logger =
        Logger.getLogger(TestAccountInstallation.class);
    /**
     * The lock that we wait on until registration is finalized.
     */
    private Object registrationLock = new Object();

    AccountManager icqAccountManager  = null;

    public TestAccountInvalidNotification(String name)
    {
        super(name);
    }

    protected void setUp() throws Exception
    {
        super.setUp();

    }

    protected void tearDown() throws Exception
    {
        super.tearDown();
    }

    /**
     * It is not meaningful to define a test suite. Each of the
     * pseudo-tests reports a different setup failure, so the
     * appropriate test should be added individually.
     *
     * As a safety measure, we add an empty test suite which
     * will generate a "no tests found" failure.
     */
    public static Test suite()
    {
        TestSuite suite = new TestSuite();
        // will generate a jUnit "no tests found" error condition
        return suite;
    }

    /**
     * The icq test suites MUST have an accounts.properties file
     * that defines two icq test accounts. This test is ONLY
     * executed when icqProtocolProviderSlick.start() has failed
     * to load the Properties and it deliberately fails with a
     * meaningful message.
     */
    public void failIcqTesterAgentMissing()
    {
        fail("The IcqTesterAgent on icq was not defined. "
             +"(Possible reasons: account.properties file not found "
             +"in lib directory. Please see wiki for advice on unit "
             +"test setup.)");
    }

    /**
     * This test is ONLY executed when icqProtocolProviderSlick.start()
     * has failed to register with the icq service when providing
     * the username and password defined in the account.properties file.
     * It deliberately fails with a meaningful message.
     */
    public void failIcqTesterAgentRegisterRejected()
    {
        fail("Registering the IcqTesterAgent on icq has failed. "
             +"(Possible reasons: password not defined, authentification " +
                "failed, or Connection rate limit exceeded.)");
    }
}

@@ -2165,36 +2165,34 @@
 . %22%0A            
- 
 +%22
-(
 Possible reasons
@@ -2229,17 +2229,16 @@
 found %22%0A
- 
         
@@ -2310,17 +2310,16 @@
         
- 
 +%22test s
@@ -2323,17 +2323,16 @@
 t setup.
-)
 %22);%0A    
@@ -2758,12 +2758,10 @@
     
- 
 +%22
-(
 Poss
@@ -2778,76 +2778,122 @@
 ns: 
-password not defined, authentification %22 +%0A                %22failed, 
+authentification failure (wrong ICQ %22%0A            +%22account number, no password, wrong password), %22%0A            +%22
 or C
@@ -2922,17 +2922,16 @@
 xceeded.
-)
 %22);%0A    

improve content of junit failure message for icq test account registration problems