final Map<String, String> queryParameters,
final List<String> acceptHeaders,
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 ? new HashMap<String, String>() : queryParameters);
when(request.getContentType()).thenReturn(requestContentType);
when(request.getAcceptHeaders()).thenReturn(acceptHeaders);