### Question:
XmlEntityConsumer { public Object readPropertyValue(final EdmProperty edmProperty, final InputStream content) throws EntityProviderException { return readPropertyValue(edmProperty, content, null); } XmlEntityConsumer(); ODataDeltaFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
      final EntityProviderReadProperties properties); ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content,
      final EntityProviderReadProperties properties); Map<String, Object> readProperty(final EdmProperty edmProperty, final InputStream content,
      final EntityProviderReadProperties properties); Map<String, Object> readProperty(final EntityPropertyInfo propertyInfo, final InputStream content,
      final EntityProviderReadProperties readProperties); Object readPropertyValue(final EdmProperty edmProperty, final InputStream content); Object readPropertyValue(final EdmProperty edmProperty, final InputStream content, final Class<?> typeMapping); Object readCollection(final EntityPropertyInfo info, InputStream content,
      final EntityProviderReadProperties properties); String readLink(final EdmEntitySet entitySet, final Object content); List<String> readLinks(final EdmEntitySet entitySet, final Object content);  }### Answer:
@Test public void readStringPropertyValue() throws Exception { String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">Max Mustermann</EmployeeName>"; InputStream content = createContentAsStream(xml); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName"); Object result = new XmlEntityConsumer().readPropertyValue(property, content, String.class); assertEquals("Max Mustermann", result); }
@Test public void readLargeStringPropertyValue() throws Exception { String name = StringHelper.generateData(77777); String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">" + name + "</EmployeeName>"; InputStream content = createContentAsStream(xml); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName"); Object result = new XmlEntityConsumer().readPropertyValue(property, content, String.class); assertEquals(name, result); }
@Test(expected = EntityProviderException.class) public void readStringPropertyValueWithInvalidMapping() throws Exception { String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">Max Mustermann</EmployeeName>"; InputStream content = createContentAsStream(xml); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName"); new XmlEntityConsumer().readPropertyValue(property, content, Integer.class); }
@Test(expected = EntityProviderException.class) public void readPropertyWrongNamespace() throws Exception { String xml = "<Age xmlns=\"" + Edm.NAMESPACE_M_2007_08 + "\">1</Age>"; InputStream content = createContentAsStream(xml); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age"); new XmlEntityConsumer().readPropertyValue(property, content, Integer.class); }
@Test(expected = EntityProviderException.class) public void readPropertyWrongClosingNamespace() throws Exception { String xml = "<d:Age xmlns:d=\"" + Edm.NAMESPACE_D_2007_08 + "\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">1</m:Age>"; InputStream content = createContentAsStream(xml); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age"); new XmlEntityConsumer().readPropertyValue(property, content, Integer.class); }