You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/07/09 00:21:33 UTC

[6/9] git commit: Convert one more TestNG test to Spock

Convert one more TestNG test to Spock


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a25b7ac9
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a25b7ac9
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a25b7ac9

Branch: refs/heads/5.4-js-rewrite
Commit: a25b7ac95a05d8c8b36ff9ea0d0acba7866106f5
Parents: 9879449
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 8 14:58:40 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 8 14:58:40 2012 -0700

----------------------------------------------------------------------
 tapestry-json/build.gradle                         |    4 ++
 .../test/groovy/json/specs/CoercionsSpec.groovy    |   29 ++++++++++
 .../org/apache/tapestry/json/CoercionTests.groovy  |   43 ---------------
 3 files changed, 33 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a25b7ac9/tapestry-json/build.gradle
----------------------------------------------------------------------
diff --git a/tapestry-json/build.gradle b/tapestry-json/build.gradle
index e1924ab..bf3eb8a 100644
--- a/tapestry-json/build.gradle
+++ b/tapestry-json/build.gradle
@@ -6,6 +6,10 @@ dependencies {
     testCompile "org.spockframework:spock-core:${versions.spock}"
 }
 
+test {
+    useJUnit()
+}
+
 jar {
     manifest {
         attributes 'Tapestry-Module-Classes': 'org.apache.tapestry5.json.services.JSONModule'

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a25b7ac9/tapestry-json/src/test/groovy/json/specs/CoercionsSpec.groovy
----------------------------------------------------------------------
diff --git a/tapestry-json/src/test/groovy/json/specs/CoercionsSpec.groovy b/tapestry-json/src/test/groovy/json/specs/CoercionsSpec.groovy
new file mode 100644
index 0000000..d7c1d14
--- /dev/null
+++ b/tapestry-json/src/test/groovy/json/specs/CoercionsSpec.groovy
@@ -0,0 +1,29 @@
+package json.specs
+
+import org.apache.tapestry5.internal.json.StringToJSONArray
+import org.apache.tapestry5.internal.json.StringToJSONObject
+import org.apache.tapestry5.json.JSONArray
+import org.apache.tapestry5.json.JSONObject
+import spock.lang.Specification
+
+class CoercionsSpec extends Specification {
+
+    def "string to JSONObject"() {
+        def json = /{foo:"bar"}/
+        def expected = new JSONObject(json)
+
+        expect:
+
+        new StringToJSONObject().coerce(json) == expected
+    }
+
+    void "string to JSONArray"() {
+
+        def json = /[1, 2, 'three']/
+        def expected = new JSONArray(json)
+
+        expect:
+
+        new StringToJSONArray().coerce(json) == expected
+    }
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a25b7ac9/tapestry-json/src/test/groovy/org/apache/tapestry/json/CoercionTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-json/src/test/groovy/org/apache/tapestry/json/CoercionTests.groovy b/tapestry-json/src/test/groovy/org/apache/tapestry/json/CoercionTests.groovy
deleted file mode 100644
index 0a7d11d..0000000
--- a/tapestry-json/src/test/groovy/org/apache/tapestry/json/CoercionTests.groovy
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2011 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry.json
-
-import org.testng.annotations.Test
-import org.apache.tapestry5.internal.json.StringToJSONObject
-import org.apache.tapestry5.json.JSONObject
-import org.apache.tapestry5.json.JSONArray
-import org.apache.tapestry5.internal.json.StringToJSONArray
-
-/**
- *
- */
-class CoercionTests {
-
-    @Test
-    void string_to_JSONObject()
-    {
-        def expected = new JSONObject().put("foo", "bar")
-
-        assert new StringToJSONObject().coerce("{ 'foo' : 'bar' }") == expected
-    }
-
-    @Test
-    void string_to_JSONArray() {
-        def expected = new JSONArray(1, 2, "three");
-
-        assert new StringToJSONArray().coerce("[ 1, 2, 'three' ]") == expected
-
-    }
-}