### Question:
DialogsDataSource extends SlingSafeMethodsServlet { @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { try { Resource resource = request.getResource(); ResourceResolver resolver = request.getResourceResolver(); 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)) { log.warn("Path unavailable"); return; } setDataSource(resource, path, resolver, request, itemResourceType); } catch (RepositoryException e) { log.warn("Unable to list classic dialogs", e.getMessage()); } }    }### Answer:
@Test public void testDoGet() throws Exception { List<String> expectedDialogPaths = new ArrayList<String>(); expectedDialogPaths.addAll(Arrays.asList( DIALOGS_ROOT + "/classic/dialog", DIALOGS_ROOT + "/classic/design_dialog", DIALOGS_ROOT + "/coral2/cq:dialog", DIALOGS_ROOT + "/coral2/cq:design_dialog", DIALOGS_ROOT + "/level1/classicandcoral2/cq:dialog", DIALOGS_ROOT + "/level1/classicandcoral2/cq:design_dialog", DIALOGS_ROOT + "/level1/converted/dialog", DIALOGS_ROOT + "/level1/converted/cq:design_dialog.coral2", DIALOGS_ROOT + "/level1/coral2andbackup/cq:dialog")); dialogsDataSource.doGet(request, response); ArgumentCaptor<DataSource> dataSourceArgumentCaptor = ArgumentCaptor.forClass(DataSource.class); Mockito.verify(request).setAttribute(Mockito.anyString(), dataSourceArgumentCaptor.capture()); DataSource dialogsDataSource = dataSourceArgumentCaptor.getValue(); @SuppressWarnings("unchecked") List<Resource> dialogsList = IteratorUtils.toList(dialogsDataSource.iterator()); assertEquals(expectedDialogPaths.size(), dialogsList.size()); for (Resource dialogResource : dialogsList) { ValueMap valueMap = dialogResource.getValueMap(); assertNotNull(valueMap.get("dialogPath")); assertNotNull(valueMap.get("type")); assertNotNull(valueMap.get("href")); assertNotNull(valueMap.get("converted")); assertNotNull(valueMap.get("crxHref")); expectedDialogPaths.remove(valueMap.get("dialogPath")); } assertEquals(0, expectedDialogPaths.size()); }