@Test
public void createsComplexGroovyBean() throws Exception {

    Class<?> aBookClass = parseGroovyClass("BookBean.groovy");
    Class<?> aStorageClass = parseGroovyClass("BookStorage.groovy");
    GroovyObject junitBook = (GroovyObject)aBookClass.getDeclaredMethod("createJunitBook").invoke(null);
    GroovyObject cSharpBook = (GroovyObject)aBookClass.getDeclaredMethod("createCSharpBook").invoke(null);
    GroovyObject javaScriptBook = (GroovyObject)aBookClass.getDeclaredMethod("createJavaScriptBook").invoke(null);
    JsonValue jsonObject = createJsonObject("books",
                                            createJsonArray(createJsonBook(junitBook), createJsonBook(cSharpBook), createJsonBook(javaScriptBook)));
    GroovyObject groovyObject = (GroovyObject)ObjectBuilder.createObject(aStorageClass, jsonObject);
    assertEquals(aStorageClass.getDeclaredMethod("createBookStorage").invoke(null), groovyObject);
}