final List<String> pathSegments, final Map<String, String> queryParameters,
final String httpHeaderName, final String httpHeaderValue,
final String requestContentType) throws ODataException {
ODataRequest request = mock(ODataRequest.class);
when(request.getMethod()).thenReturn(method);
PathInfo pathInfo = mock(PathInfo.class);
List<PathSegment> segments = new ArrayList<PathSegment>();
for (final String pathSegment : pathSegments) {
PathSegment segment = mock(PathSegment.class);
when(segment.getPath()).thenReturn(pathSegment);
segments.add(segment);
}
when(pathInfo.getODataSegments()).thenReturn(segments);
when(request.getPathInfo()).thenReturn(pathInfo);
when(request.getQueryParameters()).thenReturn(
queryParameters == null ? Collections.<String, String> emptyMap() : queryParameters);
when(request.getContentType()).thenReturn(
requestContentType == null ? HttpContentType.APPLICATION_JSON : requestContentType);