title: How to create instance of WCMUsePojo in my Prosper spec?
body: <p>I have a functioning WCMUsePojo Groovy class which is called from a sightly html component. I am trying to create an instance of my WCMUsePojo class for testing based on the content from the <a href="https://github.com/Citytechinc/prosper" rel="nofollow noreferrer">Prosper</a> setup method.</p>
  
  <p>It's basically the same type of question as <a href="https://stackoverflow.com/questions/37582439/how-can-i-create-an-instance-of-wcmusepojo-in-a-servlet-for-a-specific-page">How can I create an instance of WCMUsePojo in a servlet for a specific page?</a> But I don't see it answered and this is specifically about how to unit test methods in WCMUsePojo classes within the Prosper framework. Is there a Java or Groovy equivalent to Sightly's data-sly-use attribute?</p>
  
  <pre><code>def setupSpec() {
      pageBuilder.content {
          page_with_new_gridwrapper {
              'jcr:content'{
                  'gridpar' {
                      'my_gridwrapper'('sling:resourceType':'my/components/my_gridwrapper') {
  
                      }
                  }
              }
          }
      }
  }
  
  def "Test Page with New Grid Container"(){
      Page page = pageManager.getPage("/content/page_with_new_gridwrapper")
  
   // the following 2 lines return null :-( 
   // but I would prefer these to return an object with the type MyGridContainerHelper
      MyGridContainerHelper cmp = page.getContentResource().getChild("gridpar/my_gridwrapper").adaptTo(MyGridContainerHelper.class)
      Component cmp2 = WCMUtils.getComponent(page.getContentResource().getChild("gridpar/my_gridwrapper"))
  
      expect:
      page != null //passes
      page.getContentResource().getChild("gridpar/my_gridwrapper") != null //passes
      cmp != null // fails
      cmp2 != null // fails
      cmp.resourceType == "my/components/my_gridwrapper" // fails
  
  }
  </code></pre>