!3 Expectations in Javascript on responses with content type application/json

As of .RestFixture Version 2, a javascript engine is embedded to allow expectations in Javascript on response body contents in JSON format.

!**** XPaths and JSON
For backward compatibility XPath expressions are maintained and executed
****!

After a successful response is received with content type "application/json" the expectation cell in a .RestFixture row is
interpreted as a string with Javascript and executed within the context of the response body.

| Fit Rest Fixture |http://${jettyHost}:${jettyPort}|
|setBody|!- { "resource" : { "name" : "test post", "data" : "some data" } } -!|
|POST   | /resources/ | 201 | | no-body |
|let    | id | header | Location:/resources/(.+) | |

A variable <code>jsonbody</code> is defined holding the JSON in the response.

The test passes if the result of the evaluation of the cell is a boolean.

| Fit Rest Fixture |http://${jettyHost}:${jettyPort}|
|GET    | /resources/%id%.json | 200 |Content-Type : application/json |!-
jsonbody.resource.name=="test post" && jsonbody.resource.data=="some data" 
-!|

It is possible to specify multiple assertions, one for each line. 
The test passes if each line evaluates to true.

| Fit Rest Fixture |http://${jettyHost}:${jettyPort}|
|GET    | /resources/%id%.json | 200 |Content-Type : application/json |!-
jsonbody.resource.name.length>=0 
jsonbody.resource.name.length<1000
-!|
| let   | content | js |  response.body | |

| Fit Rest Fixture |http://${jettyHost}:${jettyPort}|
|setBody| %content% |
|POST   | /resources/ | 201 | | no-body |
|let    | id | header | Location:/resources/(.+) | |

In some cases may be useful to force evaluation of the expectation cell as a javascript block. 
By embedding the <code>/* javascript */</code> comment, the whole expectation cell will be parsed and evaluated entirely using the javascript interpreter.

| Fit Rest Fixture |http://${jettyHost}:${jettyPort}|
|GET    | /resources/%id%.json | 200 |Content-Type : application/json |!-<pre>
/* javascript */
var concat = jsonbody.resource.name + " and " + jsonbody.resource.data
concat=="test post and some data" 
</pre>-!|
| let   | content | js |  response.body | |

