### Question:
AnnotationValueAccess implements ValueAccess { @Override public <T> Object getMappingValue(final T data, final EdmMapping mapping) throws ODataException { if (mapping != null && mapping.getMediaResourceMimeTypeKey() != null) { return annotationHelper.getValueForProperty(data, mapping.getMediaResourceMimeTypeKey()); } return null; }  @Override Object getPropertyValue(final T data, final EdmProperty property); @Override void setPropertyValue(final T data, final EdmProperty property, final V value); @Override Class<?> getPropertyType(final T data, final EdmProperty property); @Override Object getMappingValue(final T data, final EdmMapping mapping); @Override void setMappingValue(final T data, final EdmMapping mapping, final V value);  }### Answer:
@Test public void getMappingValue() throws Exception { AnnotationValueAccess ava = new AnnotationValueAccess(); SimpleEntity data = new SimpleEntity(); data.myMappedProperty = "mapped property value"; EdmMapping mapping = mockMapping("MyMappedProperty"); Object value = ava.getMappingValue(data, mapping); Assert.assertEquals(String.class, value.getClass()); Assert.assertEquals("mapped property value", value); }
@Test public void getMappingValueNullMapping() throws Exception { AnnotationValueAccess ava = new AnnotationValueAccess(); SimpleEntity data = new SimpleEntity(); data.myMappedProperty = "property"; EdmMapping mapping = null; Object value = ava.getMappingValue(data, mapping); Assert.assertNull(value); }
@Test public void getMappingValueNullValue() throws Exception { AnnotationValueAccess ava = new AnnotationValueAccess(); SimpleEntity data = new SimpleEntity(); data.myMappedProperty = null; EdmMapping mapping = mockMapping("MyMappedProperty"); Object value = ava.getMappingValue(data, mapping); Assert.assertNull(value); }