private JSONArray getJsonResult() throws Exception {
   PageListProvider underTest = context.registerInjectActivateService(new PageListProvider());
   underTest.service(context.request(), context.response());
   if (context.response().getStatus() == HttpServletResponse.SC_OK) {
     return new JSONArray(context.response().getOutputAsString());
   } else {
     return null;
   }
 }
    @Override
    public void execute(AemContext context) throws PersistenceException, IOException {

      // call test-specific callback first
      if (testCallback != null) {
        testCallback.execute(context);
      }

      // wcm.io Sling extensions
      MockSlingExtensions.setUp(context);

      // URL handler-specific parameter definitions
      context.registerService(ParameterProvider.class, new UrlHandlerParameterProviderImpl());

      // application provider
      context.registerService(
          ApplicationProvider.class, MockConfig.applicationProvider(APPLICATION_ID, "/content"));

      // configuration finder strategy
      context.registerService(
          ConfigurationFinderStrategy.class,
          MockConfig.configurationFinderStrategyAbsoluteParent(
              APPLICATION_ID, DummyUrlHandlerConfig.SITE_ROOT_LEVEL));

      // wcm.io configuration
      MockConfig.setUp(context);

      // media formats
      context.registerInjectActivateService(new MediaFormatProviderManagerImpl());

      // sling models registration
      context.addModelsForPackage("io.wcm.handler.url");
      context.addModelsForPackage("io.wcm.handler.media");
      context.addModelsForPackage("io.wcm.handler.link");
      context.addModelsForPackage("io.wcm.handler.richtext");

      // create current page in site context
      context.currentPage(
          context.create().page(ROOTPATH_CONTENT, DummyAppTemplate.CONTENT.getTemplatePath()));

      // default site config
      MockConfig.writeConfiguration(
          context,
          ROOTPATH_CONTENT,
          ImmutableValueMap.builder()
              .put(UrlParams.SITE_URL.getName(), "http://www.dummysite.org")
              .put(UrlParams.SITE_URL_SECURE.getName(), "https://www.dummysite.org")
              .put(UrlParams.SITE_URL_AUTHOR.getName(), "https://author.dummysite.org")
              .build());
    }