function testExpression(assert, sXmlSnippet, vExpected, sODataVersion) {
		var aMatches, sPath;

		function convert(Converter, sXml) {
			var oResult = new Converter().convertXMLMetadata(xml(assert, sXml));
			assert.deepEqual(oResult["foo."].$Annotations["foo.Bar"]["@foo.Term"], vExpected,
				sXml);
		}

		function localTest() {
			if (!sODataVersion || sODataVersion === "2.0") {
				convert(_V2MetadataConverter, sV2Start + sXmlSnippet + sEnd);
			}
			if (!sODataVersion || sODataVersion === "4.0") {
				convert(_V4MetadataConverter, sV4Start + sXmlSnippet + sEnd);
			}
		}

		sXmlSnippet = '\
			<Schema Namespace="foo" Alias="f">\
				<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="foo.Bar">\
					<Annotation Term="foo.Term">' + sXmlSnippet + '</Annotation>\
				</Annotations>\
			</Schema>';

		localTest();

		// Rewrite sXmlSnippet and vExpectedValue so that the (first) Path is converted to a
		// (rather stupid) If and thus create a recursive expression.
		aMatches = /<Path>(.*?)<\/Path>/.exec(sXmlSnippet);
		if (aMatches) {
			sPath = aMatches[1];
			sXmlSnippet = sXmlSnippet.replace("<Path>" + sPath + "</Path>",
				"<If><Bool>true</Bool><Path>" + sPath + "</Path><Null/></If>");
			sPath = '{"$Path":"' + sPath.replace(/f\./g, "foo.") + '"}';
			vExpected = JSON.parse(JSON.stringify(vExpected)
				.replace(sPath, '{"$If":[true,' + sPath + ',null]}'));
			localTest();
		}
	}
/**
	 * Tests the conversion of the given XML snippet of a constant/dynamic expression below an
	 * Annotation element. If the expression contains a Path element, a second test is performed
	 * with the Path element replaced by an expression. By this recursive expressions are tested
	 * automatically.
	 *
	 * @param {object} assert
	 *   QUnit's assert
	 * @param {string} sXmlSnippet
	 *   the XML snippet; it will be inserted below an Annotation element
	 * @param {any} vExpected
	 *   the expected value for the annotation
	 * @param {string} sODataVersion
	 *   the OData version to use for the test
	 */
Tests the conversion of the given XML snippet of a constant/dynamic expression below an
Annotation element. If the expression contains a Path element, a second test is performed
with the Path element replaced by an expression. By this recursive expressions are tested
automatically.

@param {object} assert
QUnit's assert
@param {string} sXmlSnippet
the XML snippet; it will be inserted below an Annotation element
@param {any} vExpected
the expected value for the annotation
@param {string} sODataVersion
the OData version to use for the test
Tests the conversion of the given XML snippet of a constant / dynamic expression below an Annotation element . If the expression contains a Path element a second test is performed with the Path element replaced by an expression . By this recursive expressions are tested automatically . @param { object } assert QUnit ' s assert @param { string } sXmlSnippet the XML snippet ; it will be inserted below an Annotation element @param { any } vExpected the expected value for the annotation @param { string } sODataVersion the OData version to use for the test
function testExpression(assert, sXmlSnippet, vExpected, sODataVersion) {
		var aMatches, sPath;
		function convert(Converter, sXml) {
			var oResult = new Converter().convertXMLMetadata(xml(assert, sXml));
			assert.deepEqual(oResult["foo."].$Annotations["foo.Bar"]["@foo.Term"], vExpected,
				sXml);
		}
		function localTest() {
			if (!sODataVersion || sODataVersion === "2.0") {
				convert(_V2MetadataConverter, sV2Start + sXmlSnippet + sEnd);
			}
			if (!sODataVersion || sODataVersion === "4.0") {
				convert(_V4MetadataConverter, sV4Start + sXmlSnippet + sEnd);
			}
		}
		sXmlSnippet = '\
			<Schema Namespace="foo" Alias="f">\
				<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="foo.Bar">\
					<Annotation Term="foo.Term">' + sXmlSnippet + '</Annotation>\
				</Annotations>\
			</Schema>';
		localTest();
		aMatches = /<Path>(.*?)<\/Path>/.exec(sXmlSnippet);
		if (aMatches) {
			sPath = aMatches[1];
			sXmlSnippet = sXmlSnippet.replace("<Path>" + sPath + "</Path>",
				"<If><Bool>true</Bool><Path>" + sPath + "</Path><Null/></If>");
			sPath = '{"$Path":"' + sPath.replace(/f\./g, "foo.") + '"}';
			vExpected = JSON.parse(JSON.stringify(vExpected)
				.replace(sPath, '{"$If":[true,' + sPath + ',null]}'));
			localTest();
		}
	}
function testExpression ( assert , sXmlSnippet , vExpected , sODataVersion ) { var aMatches , sPath ; function convert ( Converter , sXml ) { var oResult = new Converter ( ) . convertXMLMetadata ( xml ( assert , sXml ) ) ; assert . deepEqual ( oResult [ "foo." ] . $Annotations [ "foo.Bar" ] [ "@foo.Term" ] , vExpected , sXml ) ; } function localTest ( ) { if ( ! sODataVersion || sODataVersion === "2.0" ) { convert ( _V2MetadataConverter , sV2Start + sXmlSnippet + sEnd ) ; } if ( ! sODataVersion || sODataVersion === "4.0" ) { convert ( _V4MetadataConverter , sV4Start + sXmlSnippet + sEnd ) ; } } sXmlSnippet = '\
			<Schema Namespace="foo" Alias="f">\
				<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="foo.Bar">\
					<Annotation Term="foo.Term">' + sXmlSnippet + '</Annotation>\
				</Annotations>\
			</Schema>' ; localTest ( ) ; aMatches = / <Path>(.*?)<\/Path> / . exec ( sXmlSnippet ) ; if ( aMatches ) { sPath = aMatches [ 1 ] ; sXmlSnippet = sXmlSnippet . replace ( "<Path>" + sPath + "</Path>" , "<If><Bool>true</Bool><Path>" + sPath + "</Path><Null/></If>" ) ; sPath = '{"$Path":"' + sPath . replace ( / f\. / g , "foo." ) + '"}' ; vExpected = JSON . parse ( JSON . stringify ( vExpected ) . replace ( sPath , '{"$If":[true,' + sPath + ',null]}' ) ) ; localTest ( ) ; } }
Tests the conversion of the given XML snippet of a constant/dynamic expression below an
 Annotation element.
Tests the conversion of the given XML snippet of a constant / dynamic expression below an Annotation element .
// Rewrite sXmlSnippet and vExpectedValue so that the (first) Path is converted to a // (rather stupid) If and thus create a recursive expression.