### Question:
MetadataService extends PentahoBase { public MarshallableResultSet doXmlQuery( String xml, Integer rowLimit ) { IPentahoResultSet resultSet = executeQuery( xml, rowLimit ); if ( resultSet == null ) { return null; } MarshallableResultSet result = getMarshallableResultSet(); result.setResultSet( resultSet ); return result; } MetadataService(); @GET @Path( "/getDatasourcePermissions" ) @Produces( { APPLICATION_JSON } ) String getDatasourcePermissions(); ModelInfo[] listBusinessModels( String domainName ); String listBusinessModelsJson( String domainName ); Model loadModel( String domainId, String modelId ); String loadModelJson( String domainId, String modelId ); MarshallableResultSet doQuery( Query query, Integer rowLimit ); MarshallableResultSet doXmlQuery( String xml, Integer rowLimit ); String doXmlQueryToJson( String xml, int rowLimit ); String doXmlQueryToCdaJson( String xml, int rowLimit ); MarshallableResultSet doJsonQuery( String json, Integer rowLimit ); String doJsonQueryToJson( String json, int rowLimit ); String doJsonQueryToCdaJson( String json, int rowLimit ); @Override Log getLogger();  }### Answer:
@Test public void testDoXmlQuery() { String xmlQuery = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><mql><domain_id>" + DOMAIN_ID + "</domain_id><model_id" + ">" + LOGICAL_MODEL_ID + "</model_id><options><disable_distinct>false</disable_distinct><limit>-1</limit></options" + "><parameters><parameter defaultValue=\"" + VALUE + "\" name=\"" + COLUMN_NAME + "\" " + "type=\"STRING\"/></parameters><selections><selection><view>" + CATEGORY_ID + "</view><column>" + COLUMN_ID + "</column" + "><aggregation>NONE</aggregation></selection></selections><constraints><constraint><operator>AND</operator" + "><condition>[" + CATEGORY_NAME + "." + COLUMN_NAME + "] = " + VALUE + "</condition></constraint></constraints><orders/></mql>"; when( metadataService.doXmlQuery( anyString(), any( Integer.class ) ) ).thenCallRealMethod(); MarshallableResultSet marshallableResultSet = getMarshallableResultSet(); when( metadataService.getMarshallableResultSet() ).thenReturn( marshallableResultSet ); MarshallableResultSet marshallableResultSetReturned = metadataService.doXmlQuery( xmlQuery, ROWS ); MarshallableRow[] rows = marshallableResultSetReturned.getRows(); String[] cell = rows[0].getCell(); MarshallableColumnNames columnNames = marshallableResultSetReturned.getColumnNames(); String[] columnName = columnNames.getColumnName(); Assert.assertTrue( rows.length <= ROWS ); Assert.assertTrue( cell[0].equals( RESULT ) ); Assert.assertTrue( columnName[0].equals( COLUMN_NAME ) ); }