### Question:
UsersInitServlet extends SlingSafeMethodsServlet { public void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); final JsonObject json = new JsonObject(); final JsonObject existing = new JsonObject(); final JsonObject options = new JsonObject(); try { options.add(GROUPS, getGroupOptions(request.getResourceResolver())); options.add(GROUP_FILTERS, getGroupFilterOptions()); final Parameters parameters = new Parameters(request.getResource()); existing.addProperty(GROUP_FILTER, parameters.getGroupFilter()); existing.add(GROUPS, new Gson().toJsonTree(Arrays.asList(parameters.getGroups()))); existing.add(CUSTOM_PROPERTIES, parameters.getCustomPropertiesAsJSON()); json.add("options", options); json.add("form", existing); } catch (RepositoryException e) { throw new ServletException(e); } response.getWriter().write(json.toString()); response.getWriter().flush(); }  void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response);  }### Answer:
@Test public void testGroupExistence() throws Exception { UsersInitServlet servlet = new UsersInitServlet(); servlet.doGet(context.request(), context.response()); JsonObject json = new JsonParser().parse(context.response().getOutputAsString()).getAsJsonObject(); JsonObject options = json.get("options").getAsJsonObject(); JsonArray groups = options.get("groups").getAsJsonArray(); assertEquals(2,groups.size()); JSONAssert.assertEquals("[allusers, users]", groups.toString(),false); }