DefaultODataClient implements ODataClient { @Override public Object getEntity(Map<String, String> requestProperties, ODataClientQuery query) { LOG.debug("Getting entity for query {}", query); String oDataResponse = getODataResponse(requestProperties, query); try { return oDataResponse.isEmpty() ? null : componentsProvider.getUnmarshaller().unmarshallEntity(oDataResponse, query); } catch (ODataClientException oce) { throw new ODataClientRuntimeException( format("Unable unmarshall OData entity service response: \"{0}\"", oDataResponse), oce); } }  @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);  }
@Test public void testGetEntity() throws ODataException, MalformedURLException, UnsupportedEncodingException, ODataClientException { Product product = new Product() .setId(11) .setName("book name") .setCategory(Category.BOOKS); String marshalledProduct = atomMarshall( product, createODataUri("http: ODataClientQuery query = new BasicODataClientQuery.Builder().withEntityType(Product.class).build(); when(endpointCaller.callEndpoint(emptyMap(), new URL(SERVICE_URL + "/" + query.getQuery()))).thenReturn(marshalledProduct); Object entity = client.getEntity(emptyMap(), query); assertNotNull(entity); assertEquals(Product.class, entity.getClass()); assertEquals(product, entity); }