com.atlassian.sal.testresources.net
Class MockRequestFactory

java.lang.Object
  extended by com.atlassian.sal.testresources.net.MockRequestFactory
All Implemented Interfaces:
RequestFactory<Request<?,?>>

public class MockRequestFactory
extends Object
implements RequestFactory<Request<?,?>>

Mock request factory. Either mock a request and call addRequest() with the URL you want that request returned for, or the factory, if no request has been set for that URL, will create a MockRequest for you.


Constructor Summary
MockRequestFactory()
           
 
Method Summary
 void addRequest(String url, Request<?,?> request)
           
 Request<?,?> createRequest(Request.MethodType methodType, String url)
          Creates a request of given Request.MethodType to given url
 boolean supportsHeader()
          Indicates whether the requests can support headers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockRequestFactory

public MockRequestFactory()
Method Detail

addRequest

public void addRequest(String url,
                       Request<?,?> request)

createRequest

public Request<?,?> createRequest(Request.MethodType methodType,
                                  String url)
Description copied from interface: RequestFactory
Creates a request of given Request.MethodType to given url

Specified by:
createRequest in interface RequestFactory<Request<?,?>>
Parameters:
methodType - The HTTP method type
url - The url to request
Returns:
The request object

supportsHeader

public boolean supportsHeader()
Description copied from interface: RequestFactory
Indicates whether the requests can support headers

Specified by:
supportsHeader in interface RequestFactory<Request<?,?>>
Returns:
true if the requests can support headers
See Also:
Request.setHeader(String, String), Request.addHeader(String, String)


Copyright © 2011 Atlassian. All Rights Reserved.