Author: justin
Date: Wed Dec 30 19:59:21 2009
New Revision: 894702
URL: http://svn.apache.org/viewvc?rev=894702&view=rev
Log:
SLING-1257 - adding test for array wrapper creation
Modified:
sling/trunk/bundles/commons/json/src/test/groovy/org/apache/sling/commons/json/groovy/JSONGroovyBuilderTest.groovy
Modified:
sling/trunk/bundles/commons/json/src/test/groovy/org/apache/sling/commons/json/groovy/JSONGroovyBuilderTest.groovy
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/commons/json/src/test/groovy/org/apache/sling/commons/json/groovy/JSONGroovyBuilderTest.groovy?rev=894702&r1=894701&r2=894702&view=diff
==============================================================================
---
sling/trunk/bundles/commons/json/src/test/groovy/org/apache/sling/commons/json/groovy/JSONGroovyBuilderTest.groovy
(original)
+++
sling/trunk/bundles/commons/json/src/test/groovy/org/apache/sling/commons/json/groovy/JSONGroovyBuilderTest.groovy
Wed Dec 30 19:59:21 2009
@@ -98,7 +98,7 @@
JSONAssert.assertEquals(expected, actual)
}
- void testNonDefaultRootName() {
+ void testNonDefaultRootNameWithObject() {
def actual = builder.books {
book ([title: "The Definitive Guide to Grails", author:
"Graeme Rocher"])
book ([title: "Groovy in Action", author: "Dierk
Konig"])
@@ -116,6 +116,12 @@
}
+ void testNonDefaultRootNameWithArray() {
+ def actual = builder.values(["json", 1, true])
+ def expected = new JSONObject().put("values", new
JSONArray().put("json").put(1).put(true))
+ JSONAssert.assertEquals(expected, actual)
+
+ }
void testBuildObjectWithList(){
def actual = builder.json {