function withGivenService(assert, sServiceUrl, vAnnotationUrl, fnCodeUnderTest) {
		// sets up a v2 ODataModel and retrieves an ODataMetaModel from there
		var oDataModel = new ODataModel(sServiceUrl, {
				annotationURI : vAnnotationUrl,
				json : true,
				loadMetadataAsync : true
			});

		function onFailed(oEvent) {
			var oParameters = oEvent.getParameters();
			while (oParameters.getParameters) { // drill down to avoid circular structure
				oParameters = oParameters.getParameters();
			}
			assert.ok(false, "Failed to load: " + JSON.stringify(oParameters));
		}
		oDataModel.attachMetadataFailed(onFailed);
		oDataModel.attachAnnotationsFailed(onFailed);

		// calls the code under test once the meta model has loaded
		return oDataModel.getMetaModel().loaded().then(function () {
			return fnCodeUnderTest(oDataModel.getMetaModel(), oDataModel);
		});
	}
/**
	 * Runs the given code under test with an <code>ODataMetaModel</code> (and an
	 * <code>ODataModel</code>) for the given service and (array of) annotation URLs.
	 *
	 * @param {object} assert the assertions
	 * @param {string} sServiceUrl
	 *   the service URL
	 * @param {string|string[]} vAnnotationUrl
	 *   the (array of) annotation URLs
	 * @param {function} fnCodeUnderTest
	 *   the given code under test
	 * @returns {any|Promise}
	 *   (a promise to) whatever <code>fnCodeUnderTest</code> returns
	 */
Runs the given code under test with an ODataMetaModel (and an
ODataModel) for the given service and (array of) annotation URLs.


Runs the given code under test with an ODataMetaModel ( and an ODataModel ) for the given service and ( array of ) annotation URLs .
function withGivenService(assert, sServiceUrl, vAnnotationUrl, fnCodeUnderTest) {
		var oDataModel = new ODataModel(sServiceUrl, {
				annotationURI : vAnnotationUrl,
				json : true,
				loadMetadataAsync : true
			});
		function onFailed(oEvent) {
			var oParameters = oEvent.getParameters();
			while (oParameters.getParameters) { 
				oParameters = oParameters.getParameters();
			}
			assert.ok(false, "Failed to load: " + JSON.stringify(oParameters));
		}
		oDataModel.attachMetadataFailed(onFailed);
		oDataModel.attachAnnotationsFailed(onFailed);
		return oDataModel.getMetaModel().loaded().then(function () {
			return fnCodeUnderTest(oDataModel.getMetaModel(), oDataModel);
		});
	}
function withGivenService ( assert , sServiceUrl , vAnnotationUrl , fnCodeUnderTest ) { var oDataModel = new ODataModel ( sServiceUrl , { annotationURI : vAnnotationUrl , json : true , loadMetadataAsync : true } ) ; function onFailed ( oEvent ) { var oParameters = oEvent . getParameters ( ) ; while ( oParameters . getParameters ) { oParameters = oParameters . getParameters ( ) ; } assert . ok ( false , "Failed to load: " + JSON . stringify ( oParameters ) ) ; } oDataModel . attachMetadataFailed ( onFailed ) ; oDataModel . attachAnnotationsFailed ( onFailed ) ; return oDataModel . getMetaModel ( ) . loaded ( ) . then ( function ( ) { return fnCodeUnderTest ( oDataModel . getMetaModel ( ) , oDataModel ) ; } ) ; }
Runs the given code under test with an <code>ODataMetaModel</code> (and an
 <code>ODataModel</code>) for the given service and (array of) annotation URLs.
Runs the given code under test with an <code > ODataMetaModel< / code > ( and an <code > ODataModel< / code > ) for the given service and ( array of ) annotation URLs .
// sets up a v2 ODataModel and retrieves an ODataMetaModel from there // drill down to avoid circular structure // calls the code under test once the meta model has loaded