### Question:
MarketoFormDataSource extends SlingSafeMethodsServlet { @Override public void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) { log.trace("doGet"); List<Resource> options = null; MarketoClientConfiguration config = null; try { MarketoClientConfigurationManager cfgMgr = request.adaptTo(MarketoClientConfigurationManager.class); if (cfgMgr != null) { config = cfgMgr.getConfiguration(); } if (config == null) { String msg = String.format("No Marketo configuration found for resource '%s'", request.getRequestPathInfo().getSuffix()); throw new RepositoryException(msg); } int currentValue = getCurrentValue(request); options = formCache.get(config).stream() .sorted((MarketoForm f1, MarketoForm f2) -> f1.getName().compareTo(f2.getName())).map(f -> { Map<String, Object> data = new HashMap<>(); data.put("selected", currentValue == f.getId()); data.put("value", f.getId()); data.put("text", String.format("%s [%s] (%s)", f.getName(), f.getLocale(), f.getId())); return new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(), "nt:unstructured", new ValueMapDecorator(data)); }).collect(Collectors.toList()); log.debug("Loaded {} options", options.size()); } catch (Exception e) { log.warn("Failed to load Marketo forms", e); options = new ArrayList<>(); Map<String, Object> data = new HashMap<>(); data.put("value", ""); data.put("text", "Unable to load forms from Marketo"); options.add(new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(), "nt:unstructured", new ValueMapDecorator(data))); } request.setAttribute(DataSource.class.getName(), new SimpleDataSource(options.iterator())); }  @Reference void bindMarketoClient(MarketoClient client); @Override void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response);  }### Answer:
@Test public void testdoGet() throws IOException { ConfigurationResourceResolver configrr = Mockito.mock(ConfigurationResourceResolver.class); Mockito.when(configrr.getResourceCollection(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(Collections.singletonList(context.resourceResolver().getResource("/conf/test"))); context.registerService(ConfigurationResourceResolver.class, configrr); MarketoFormDataSource mktoDataSrc = new MarketoFormDataSource(); MarketoClient client = new StaticResponseMarketoClient(new String[] { "/com/adobe/acs/commons/marketo/token-response.json", "/com/adobe/acs/commons/marketo/form-response.json", "/com/adobe/acs/commons/marketo/response-noassets.json" }); mktoDataSrc.bindMarketoClient(client); mktoDataSrc.doGet(context.request(), context.response()); assertNotNull(context.request().getAttribute(DataSource.class.getName())); }