Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.ClientDriverFactory


        }
    }
   
    @Test
    public void testFailedMatchOnMultipleParameters() throws Exception {
        clientDriver = new ClientDriverFactory().createClientDriver();
       
        String url = clientDriver.getBaseUrl() + "/testing?key=value3&key=value2";
       
        clientDriver.addExpectation(
                onRequestTo("/testing").withMethod(Method.GET).withParam("key", "value1").withParam("key", "value2"),
View Full Code Here


       
    }
   
    @Test
    public void getWithBodyFailsIfMatcherFails() throws Exception {
        clientDriver = new ClientDriverFactory().createClientDriver();
       
        clientDriver.addExpectation(
                onRequestTo("/foo").withMethod(Method.GET).withBody("BODY", "text/plain"),
                giveEmptyResponse().withStatus(418));
       
View Full Code Here

        }
    }
   
    @Test
    public void deleteWithBodyFailsIfMatcherFails() throws Exception {
        clientDriver = new ClientDriverFactory().createClientDriver();
       
        clientDriver.addExpectation(
                onRequestTo("/foo").withMethod(Method.DELETE).withBody("BODY", "text/plain"),
                giveEmptyResponse().withStatus(418));
       
View Full Code Here

public class ClientDriverFactoryTest {
   
    @Test
    public void simpleTest() {
        // Hopefully no exceptions here
        assertThat(new ClientDriverFactory().createClientDriver(), instanceOf(ClientDriver.class));
    }
View Full Code Here

    @Rule
    public ExpectedException thrown = ExpectedException.none();
   
    @Before
    public void before() {
        clientDriver = new ClientDriverFactory().createClientDriver();
    }
View Full Code Here

    @Test
    public void userCanChooseOwnPort() throws IOException {
       
        int portNum = ClientDriver.getFreePort();
       
        ClientDriver driver = new ClientDriverFactory().createClientDriver(portNum);
        driver.addExpectation(onRequestTo("/url"), giveResponse("hello", "text/plain"));
       
        HttpClient client = new DefaultHttpClient();
        HttpGet getter = new HttpGet("http://localhost:" + portNum + "/url");
        HttpResponse response = client.execute(getter);
View Full Code Here

    public void correctExceptionIsThrownIfPortIsUnavailable() throws IOException {
       
        int portNum = ClientDriver.getFreePort();
       
        // one of these must throw an exception.
        new ClientDriverFactory().createClientDriver(portNum);
        new ClientDriverFactory().createClientDriver(portNum);
       
    }
View Full Code Here

    }
   
    @Test
    public void jettyFindsFreePortItself() {
       
        new ClientDriverFactory().createClientDriver();
        new ClientDriverFactory().createClientDriver();
       
    }
View Full Code Here

   
    private ClientDriver clientDriver;
   
    @Test
    public void testUnexpectedCall() throws Exception {
        clientDriver = new ClientDriverFactory().createClientDriver();
       
        // No expectations defined
       
        HttpClient client = new DefaultHttpClient();
        HttpGet getter = new HttpGet(clientDriver.getBaseUrl() + "/blah?foo=bar");
View Full Code Here

       
    }
   
    @Test
    public void testUnexpectedMultipleUnexpectedCalls() throws Exception {
        clientDriver = new ClientDriverFactory().createClientDriver();
       
        // No expectations defined
       
        HttpClient client = new DefaultHttpClient();
       
View Full Code Here

TOP

Related Classes of com.github.restdriver.clientdriver.ClientDriverFactory

Copyright © 2018 www.massapicom. 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.