Spring Social

org.springframework.social.test.client
Class MockClientHttpRequest

java.lang.Object
  extended by org.springframework.social.test.client.MockClientHttpRequest
All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequest, org.springframework.http.HttpMessage, org.springframework.http.HttpOutputMessage, org.springframework.http.HttpRequest, ResponseActions

public class MockClientHttpRequest
extends java.lang.Object
implements org.springframework.http.client.ClientHttpRequest, ResponseActions

Mock implementation of ClientHttpRequest. Implements ResponseActions to form a fluent API.

Author:
Arjen Poutsma, Lukas Krecan, Craig Walls

Constructor Summary
MockClientHttpRequest()
           
 
Method Summary
 ResponseActions andExpect(RequestMatcher requestMatcher)
          Allows for further expectations to be set on the request.
 void andRespond(ResponseCreator responseCreator)
          Sets the ResponseCreator for this mock.
 org.springframework.http.client.ClientHttpResponse execute()
           
 java.io.OutputStream getBody()
           
 java.lang.String getBodyContent()
           
 org.springframework.http.HttpHeaders getHeaders()
           
 org.springframework.http.HttpMethod getMethod()
           
 java.net.URI getURI()
           
 void setHttpMethod(org.springframework.http.HttpMethod httpMethod)
           
 void setUri(java.net.URI uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockClientHttpRequest

public MockClientHttpRequest()
Method Detail

setUri

public void setUri(java.net.URI uri)

setHttpMethod

public void setHttpMethod(org.springframework.http.HttpMethod httpMethod)

andExpect

public ResponseActions andExpect(RequestMatcher requestMatcher)
Description copied from interface: ResponseActions
Allows for further expectations to be set on the request.

Specified by:
andExpect in interface ResponseActions
Returns:
the request expectations

andRespond

public void andRespond(ResponseCreator responseCreator)
Description copied from interface: ResponseActions
Sets the ResponseCreator for this mock.

Specified by:
andRespond in interface ResponseActions
Parameters:
responseCreator - the response creator

getMethod

public org.springframework.http.HttpMethod getMethod()
Specified by:
getMethod in interface org.springframework.http.HttpRequest

getURI

public java.net.URI getURI()
Specified by:
getURI in interface org.springframework.http.HttpRequest

getHeaders

public org.springframework.http.HttpHeaders getHeaders()
Specified by:
getHeaders in interface org.springframework.http.HttpMessage

getBody

public java.io.OutputStream getBody()
                             throws java.io.IOException
Specified by:
getBody in interface org.springframework.http.HttpOutputMessage
Throws:
java.io.IOException

getBodyContent

public java.lang.String getBodyContent()
                                throws java.io.IOException
Throws:
java.io.IOException

execute

public org.springframework.http.client.ClientHttpResponse execute()
                                                           throws java.io.IOException
Specified by:
execute in interface org.springframework.http.client.ClientHttpRequest
Throws:
java.io.IOException

Spring Social