Search in sources :

Example 1 with HeaderOnlyWebRequest

use of com.meterware.httpunit.HeaderOnlyWebRequest in project camel by apache.

the class RestServletVerbTest method testDelete.

@Test
public void testDelete() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:delete");
    mock.expectedHeaderReceived("id", "1");
    mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
    WebRequest req = new HeaderOnlyWebRequest(CONTEXT_URL + "/services/users/1") {

        @Override
        public String getMethod() {
            return "DELETE";
        }
    };
    ServletUnitClient client = newClient();
    client.setExceptionsThrownOnErrorStatus(false);
    WebResponse response = client.getResponse(req);
    assertEquals(200, response.getResponseCode());
    assertMockEndpointsSatisfied();
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) HeaderOnlyWebRequest(com.meterware.httpunit.HeaderOnlyWebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) PutMethodWebRequest(com.meterware.httpunit.PutMethodWebRequest) PostMethodWebRequest(com.meterware.httpunit.PostMethodWebRequest) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) ServletUnitClient(com.meterware.servletunit.ServletUnitClient) HeaderOnlyWebRequest(com.meterware.httpunit.HeaderOnlyWebRequest) Test(org.junit.Test)

Aggregations

GetMethodWebRequest (com.meterware.httpunit.GetMethodWebRequest)1 HeaderOnlyWebRequest (com.meterware.httpunit.HeaderOnlyWebRequest)1 PostMethodWebRequest (com.meterware.httpunit.PostMethodWebRequest)1 PutMethodWebRequest (com.meterware.httpunit.PutMethodWebRequest)1 WebRequest (com.meterware.httpunit.WebRequest)1 WebResponse (com.meterware.httpunit.WebResponse)1 ServletUnitClient (com.meterware.servletunit.ServletUnitClient)1 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)1 Test (org.junit.Test)1