private void readAndExpectException(final EdmEntitySet entitySet, final InputStream reqContent, final boolean merge,
final MessageReference messageReference) throws ODataMessageException {
try {
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataEntry result =
xec.readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(merge).build());
assertNotNull(result);
Assert.fail("Expected exception with MessageReference '" + messageReference.getKey() + "' was not thrown.");
} catch (ODataMessageException e) {
assertEquals(messageReference.getKey(), e.getMessageReference().getKey());