You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/10/06 18:11:25 UTC
svn commit: r1629697 -
/tomee/tomee/trunk/tomee/tomee-webaccess/src/test/groovy/org/apache/tomee/webaccess/test/units/ScriptingTest.groovy
Author: tveronezi
Date: Mon Oct 6 16:11:25 2014
New Revision: 1629697
URL: http://svn.apache.org/r1629697
Log:
Don't fail the tests if the returning json string is not exactly the same as the expected one. The assertion should check the json content only.
Modified:
tomee/tomee/trunk/tomee/tomee-webaccess/src/test/groovy/org/apache/tomee/webaccess/test/units/ScriptingTest.groovy
Modified: tomee/tomee/trunk/tomee/tomee-webaccess/src/test/groovy/org/apache/tomee/webaccess/test/units/ScriptingTest.groovy
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/src/test/groovy/org/apache/tomee/webaccess/test/units/ScriptingTest.groovy?rev=1629697&r1=1629696&r2=1629697&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/src/test/groovy/org/apache/tomee/webaccess/test/units/ScriptingTest.groovy (original)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/src/test/groovy/org/apache/tomee/webaccess/test/units/ScriptingTest.groovy Mon Oct 6 16:11:25 2014
@@ -18,6 +18,7 @@
package org.apache.tomee.webaccess.test.units
+import groovy.json.JsonSlurper
import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.message.BasicNameValuePair
import org.apache.tomee.webaccess.rest.ApplicationConfig
@@ -56,13 +57,16 @@ class ScriptingTest {
@Test
void test() throws Exception {
Utilities.withClient(deploymentURL, { CloseableHttpClient client ->
- Assert.assertEquals(
- '{"output":"Hi there!"}',
+ def json = new JsonSlurper().parseText(
Utilities.post(deploymentURL, client, 'rest/scripting',
new BasicNameValuePair('engine', 'js'),
new BasicNameValuePair('script', 'print("Hi there!");')
)
)
+ Assert.assertEquals(
+ 'Hi there!',
+ json.output as String
+ )
def result = Utilities.post(deploymentURL, client, 'rest/scripting',
new BasicNameValuePair('engine', 'js'),
new BasicNameValuePair('script', 'throw "my bad!";')