### Question:
FAQServiceImpl implements FAQService, Constants { public Map<String, Object> getFAQSByWidget(String widgetId, String domainId) throws ServiceException { List<Map<String, Object>> faqs = new ArrayList<>(); List<Map<String, Object>> faqByWidgetIdList; List<Map<String, Object>> releventfaqsByWidgetIdList = new ArrayList<>(); try{ faqByWidgetIdList= repository.getFAQSFromEs( widgetId, domainId); }catch(DataException e){ throw new ServiceException(e); } List<String> faqId = new ArrayList<>(); List<String> tags = new ArrayList<>(); faqByWidgetIdList.parallelStream().forEach(faqDetailsMap -> { synchronized (faqId) { faqId.add('"' + faqDetailsMap.get("faqid").toString() + '"'); } synchronized (tags) { tags.add('"' + faqDetailsMap.get("tag").toString() + '"'); } Map<String, Object> faqDetails = new HashMap<>(); faqDetails.put("faqName", faqDetailsMap.get("faqname")); faqDetails.put("faqAnswer", faqDetailsMap.get("answer")); synchronized (faqs) { faqs.add(faqDetails); } }); try{ releventfaqsByWidgetIdList = repository.getRelevantFAQSFromEs(widgetId, domainId, tags, faqId, releventfaqsByWidgetIdList); }catch(DataException e){ throw new ServiceException(e); } Map<String, Object> respoMap = new HashMap<>(); respoMap.put("faq", faqs); respoMap.put("releventFaq", releventfaqsByWidgetIdList); if(respoMap.isEmpty()){ throw new ServiceException(NO_DATA_FOUND); } return respoMap; }  Map<String, Object> getFAQSByWidget(String widgetId, String domainId);  }### Answer:
@Test public void getFAQSByWidgetTest() throws Exception { Map<String, Object> targetTypesMap = new HashMap<>(); targetTypesMap.put("faqid", "q5"); targetTypesMap.put("tag", "vulnerabilities"); List<Map<String, Object>> maintargetTypesList = new ArrayList<>(); maintargetTypesList.add(targetTypesMap); when(repository.getFAQSFromEs(anyString(), anyString())) .thenReturn(maintargetTypesList); when(repository.getRelevantFAQSFromEs( anyString(), anyString(), anyObject(), anyObject(), anyObject())) .thenReturn(maintargetTypesList); assertThat(faqServiceImpl.getFAQSByWidget("aws-all", ""), is(notNullValue())); }