}
return request;
}
private ODataService mockODataService(final ODataServiceFactory serviceFactory) throws ODataException {
ODataService service = DispatcherTest.getMockService();
when(service.getEntityDataModel()).thenReturn(edm);
when(service.getProcessor()).thenReturn(mock(ODataProcessor.class));
when(serviceFactory.createService(any(ODataContext.class))).thenReturn(service);
when(service.getSupportedContentTypes(BatchProcessor.class)).thenReturn(
Arrays.asList(HttpContentType.MULTIPART_MIXED));
final List<String> jsonAndXml = Arrays.asList(
HttpContentType.APPLICATION_JSON,
HttpContentType.APPLICATION_JSON_VERBOSE,
HttpContentType.APPLICATION_JSON_UTF8,
HttpContentType.APPLICATION_JSON_UTF8_VERBOSE,
HttpContentType.APPLICATION_XML_UTF8);
List<String> atomEntryAndJsonAndXml = new ArrayList<String>();
atomEntryAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_ENTRY_UTF8);
atomEntryAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_UTF8);
atomEntryAndJsonAndXml.addAll(jsonAndXml);
when(service.getSupportedContentTypes(EntityProcessor.class)).thenReturn(atomEntryAndJsonAndXml);
when(service.getSupportedContentTypes(FunctionImportProcessor.class)).thenReturn(jsonAndXml);
when(service.getSupportedContentTypes(EntityLinkProcessor.class)).thenReturn(jsonAndXml);
when(service.getSupportedContentTypes(EntityLinksProcessor.class)).thenReturn(jsonAndXml);
when(service.getSupportedContentTypes(EntitySimplePropertyProcessor.class)).thenReturn(jsonAndXml);
when(service.getSupportedContentTypes(EntityComplexPropertyProcessor.class)).thenReturn(jsonAndXml);
final List<String> wildcard = Arrays.asList(HttpContentType.WILDCARD);
when(service.getSupportedContentTypes(EntityMediaProcessor.class)).thenReturn(wildcard);
when(service.getSupportedContentTypes(EntitySimplePropertyValueProcessor.class)).thenReturn(wildcard);
when(service.getSupportedContentTypes(FunctionImportValueProcessor.class)).thenReturn(wildcard);
List<String> atomFeedAndJsonAndXml = new ArrayList<String>();
atomFeedAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_FEED_UTF8);
atomFeedAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_UTF8);
atomFeedAndJsonAndXml.addAll(jsonAndXml);
when(service.getSupportedContentTypes(EntitySetProcessor.class)).thenReturn(atomFeedAndJsonAndXml);
when(service.getSupportedContentTypes(MetadataProcessor.class)).thenReturn(Arrays.asList(
HttpContentType.APPLICATION_XML_UTF8));
List<String> atomSvcAndJsonAndXml = new ArrayList<String>();
atomSvcAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_SVC_UTF8);
atomSvcAndJsonAndXml.addAll(jsonAndXml);
when(service.getSupportedContentTypes(ServiceDocumentProcessor.class)).thenReturn(atomSvcAndJsonAndXml);
return service;
}