### Question:
SoapTagService extends AbstractService implements TagService { @Override public WSDocument[] findDocumentsByTag(String sid, String tag) throws Exception { User user = validateSession(sid); DocumentDAO docDao = (DocumentDAO) Context.get().getBean(DocumentDAO.class); List<Document> docs = docDao.findByUserIdAndTag(user.getId(), tag, null); WSDocument[] wsDocs = new WSDocument[docs.size()]; for (int i = 0; i < docs.size(); i++) { try { checkPublished(user, docs.get(i)); checkNotArchived(docs.get(i)); } catch (Exception e) { continue; } docDao.initialize(docs.get(i)); wsDocs[i] = WSUtil.toWSDocument(docs.get(i)); } return wsDocs; }  @Override void setDocumentTags(String sid, long docId, String[] tags); @Override void addDocumentTags(String sid, long docId, String[] tags); @Override String[] getDocumentTags(String sid, long docId); @Override void setFolderTags(String sid, long folderId, String[] tags); @Override void addFolderTags(String sid, long folderId, String[] tags); @Override String[] getFolderTags(String sid, long folderId); @Override String[] getTags(String sid); @Override String[] getTagsPreset(String sid); @Override WSTagCloud[] getTagCloud(String sid); @Override WSDocument[] findDocumentsByTag(String sid, String tag); @Override WSFolder[] findFoldersByTag(String sid, String tag);  }### Answer:
@Test public void testFindDocumentsByTag() throws Exception { WSDocument[] documents = tagService.findDocumentsByTag("", "abc"); Assert.assertNotNull(documents); Assert.assertEquals(1, documents.length); List<WSDocument> docsList = Arrays.asList(documents); Assert.assertEquals(1, docsList.get(0).getId()); documents = tagService.findDocumentsByTag("", "ask"); Assert.assertNotNull(documents); Assert.assertEquals(1, documents.length); docsList = Arrays.asList(documents); Assert.assertEquals(2, docsList.get(0).getId()); documents = tagService.findDocumentsByTag("", "xxx"); Assert.assertNotNull(documents); Assert.assertEquals(0, documents.length); }