Package net.jsunit

Source Code of net.jsunit.ClientServerInteractionTest

package net.jsunit;

import junit.framework.TestCase;
import net.jsunit.model.Browser;
import net.jsunit.model.DummyBrowserSource;

public class ClientServerInteractionTest extends TestCase {

    private RemoteTestRunClient client;
    private TestRunNotifierServer server;
    private MockTestRunListener mockTestRunListener;

    public void setUp() throws Exception {
        super.setUp();
        mockTestRunListener = new MockTestRunListener();
        client = new RemoteTestRunClient(new DummyBrowserSource("mybrowser.exe", 4), mockTestRunListener, 8083);
        client.startListening();
        server = new TestRunNotifierServer(new MockBrowserTestRunner(), 8083);
        server.testRunStarted();
    }

    public void tearDown() throws Exception {
        server.testRunFinished();
        client.stopListening();
        super.tearDown();
    }

    public void testSimple() throws InterruptedException {

        server.browserTestRunStarted(new Browser("mybrowser.exe", 4));
        while (!mockTestRunListener.browserTestRunStartedCalled)
            Thread.sleep(3);
        assertEquals(new Browser("mybrowser.exe", 4), mockTestRunListener.browser);
    }

}
TOP

Related Classes of net.jsunit.ClientServerInteractionTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.