### Question:
PageDataSource extends SlingSafeMethodsServlet { @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { try { Resource resource = request.getResource(); ValueMap properties = resource.getValueMap(); String itemResourceType = properties.get("itemResourceType", String.class); String path = properties.get("path", String.class); path = expressionResolver.resolve(path, request.getLocale(), String.class, request); if (StringUtils.isEmpty(path)) { logger.warn("Path unavailable"); return; } setDataSource(path, request, itemResourceType); } catch (RepositoryException e) { logger.warn("Unable to list components: {}", e.getMessage()); } }    }### Answer:
@Test public void testDoGet() throws Exception { List<String> expectedPagePaths = new ArrayList<>(); expectedPagePaths.add(PAGE_ROOT + "/matches/jcr:content"); expectedPagePaths.add(PAGE_ROOT + "/fourColumns/jcr:content"); pageDataSource.doGet(request, response); ArgumentCaptor<DataSource> dataSourceArgumentCaptor = ArgumentCaptor.forClass(DataSource.class); Mockito.verify(request).setAttribute(Mockito.anyString(), dataSourceArgumentCaptor.capture()); DataSource pageDataSource = dataSourceArgumentCaptor.getValue(); @SuppressWarnings("unchecked") List<Resource> pageList = IteratorUtils.toList(pageDataSource.iterator()); assertEquals(expectedPagePaths.size(), pageList.size()); for (Resource componentResource : pageList) { ValueMap valueMap = componentResource.getValueMap(); assertNotNull(valueMap.get("title")); assertNotNull(valueMap.get("pagePath")); assertNotNull(valueMap.get("templateType")); assertNotNull(valueMap.get("href")); assertNotNull(valueMap.get("crxHref")); expectedPagePaths.remove(valueMap.get("pagePath")); } assertEquals(0, expectedPagePaths.size()); }