@Test public void testGetEntities() throws MalformedURLException, ODataClientException, ODataException, UnsupportedEncodingException { List<Product> products = Stream.of( createProduct(11, "Book 11", BOOKS), createProduct(12, "Electronics 12", ELECTRONICS)) .collect(Collectors.toList()); String marshalledProduct = atomMarshall( products, createODataUri("http: ODataClientQuery query = new BasicODataClientQuery.Builder().withEntityType(Product.class).build(); when(endpointCaller.callEndpoint(emptyMap(), new URL(SERVICE_URL + "/" + query.getQuery()))) .thenReturn(marshalledProduct); List<Object> entities = (List<Object>) client.getEntities(emptyMap(), query); assertNotNull(entities); assertEquals(2, entities.size()); assertEquals(products.get(0), entities.get(0)); assertEquals(products.get(1), entities.get(1)); }
@Override public List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query) { LOG.debug("Getting entities for query {}", query); String oDataResponse = getODataResponse(requestProperties, query); try { return oDataResponse.isEmpty() ? new ArrayList<>() : componentsProvider.getUnmarshaller().unmarshall(oDataResponse, query); } catch (ODataClientException e) { throw new ODataClientRuntimeException( format("Unable unmarshall OData entities service response: \"{0}\"", oDataResponse), e); } }
DefaultODataClient implements ODataClient { @Override public List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query) { LOG.debug("Getting entities for query {}", query); String oDataResponse = getODataResponse(requestProperties, query); try { return oDataResponse.isEmpty() ? new ArrayList<>() : componentsProvider.getUnmarshaller().unmarshall(oDataResponse, query); } catch (ODataClientException e) { throw new ODataClientRuntimeException( format("Unable unmarshall OData entities service response: \"{0}\"", oDataResponse), e); } } }
DefaultODataClient implements ODataClient { @Override public List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query) { LOG.debug("Getting entities for query {}", query); String oDataResponse = getODataResponse(requestProperties, query); try { return oDataResponse.isEmpty() ? new ArrayList<>() : componentsProvider.getUnmarshaller().unmarshall(oDataResponse, query); } catch (ODataClientException e) { throw new ODataClientRuntimeException( format("Unable unmarshall OData entities service response: \"{0}\"", oDataResponse), e); } }  }
DefaultODataClient implements ODataClient { @Override public List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query) { LOG.debug("Getting entities for query {}", query); String oDataResponse = getODataResponse(requestProperties, query); try { return oDataResponse.isEmpty() ? new ArrayList<>() : componentsProvider.getUnmarshaller().unmarshall(oDataResponse, query); } catch (ODataClientException e) { throw new ODataClientRuntimeException( format("Unable unmarshall OData entities service response: \"{0}\"", oDataResponse), e); } }  @Override void configure(ODataClientComponentsProvider clientComponentsProvider); @Override void encodeURL(boolean encode); @Override Object getEntity(Map<String, String> requestProperties, ODataClientQuery query); @Override Object performAction(Map<String, String> properties, ODataActionClientQuery actionQuery); ODataClientComponentsProvider getComponentsProvider(); @Override List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query); @Override Object getMetaData(Map<String, String> requestProperties, ODataClientQuery builder); @Override Iterable<Object> getLinks(ODataClientQuery builder); @Override Iterable<Object> getCollections(ODataClientQuery builder); @Override Object createEntity(Map<String, String> requestProperties, Object entity); @Override Object updateEntity(Map<String, String> requestProperties, ODataIdAwareEntity entity); @Override void deleteEntity(Map<String, String> requestProperties, ODataIdAwareEntity entity); @Override InputStream getInputStream(Map<String, String> requestProperties, URL url); }
DefaultODataClient implements ODataClient { @Override public List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query) { LOG.debug("Getting entities for query {}", query); String oDataResponse = getODataResponse(requestProperties, query); try { return oDataResponse.isEmpty() ? new ArrayList<>() : componentsProvider.getUnmarshaller().unmarshall(oDataResponse, query); } catch (ODataClientException e) { throw new ODataClientRuntimeException( format("Unable unmarshall OData entities service response: \"{0}\"", oDataResponse), e); } }  @Override void configure(ODataClientComponentsProvider clientComponentsProvider); @Override void encodeURL(boolean encode); @Override Object getEntity(Map<String, String> requestProperties, ODataClientQuery query); @Override Object performAction(Map<String, String> properties, ODataActionClientQuery actionQuery); ODataClientComponentsProvider getComponentsProvider(); @Override List<?> getEntities(Map<String, String> requestProperties, ODataClientQuery query); @Override Object getMetaData(Map<String, String> requestProperties, ODataClientQuery builder); @Override Iterable<Object> getLinks(ODataClientQuery builder); @Override Iterable<Object> getCollections(ODataClientQuery builder); @Override Object createEntity(Map<String, String> requestProperties, Object entity); @Override Object updateEntity(Map<String, String> requestProperties, ODataIdAwareEntity entity); @Override void deleteEntity(Map<String, String> requestProperties, ODataIdAwareEntity entity); @Override InputStream getInputStream(Map<String, String> requestProperties, URL url);  }