### Question:
TaggingRepositoryImpl implements TaggingRepository, Constants { public Long getUntaggedIssues(String assetGroup, String mandatoryTag) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); Map<String, Object> mustNotFilter = new HashMap<>(); Map<String, Object> mustTermsFilter = new HashMap<>(); HashMultimap<String, Object> shouldFilter = HashMultimap.create(); Map<String, List<String>> matchPhrasePrefix = new HashMap<>(); List<String> mandatoryTagsList = new ArrayList<>(); if (mandatoryTag != null) { mandatoryTagsList.add(mandatoryTag); } mustFilter.put(CommonUtils.convertAttributetoKeyword(TYPE), ISSUE); mustFilter.put(CommonUtils.convertAttributetoKeyword(POLICYID), TAGGIG_POLICY); matchPhrasePrefix.put(MISSING_TAGS, mandatoryTagsList); shouldFilter.put(CommonUtils.convertAttributetoKeyword(ISSUE_STATUS), OPEN); try{ return elasticSearchRepository .getTotalDistributionForIndexAndTypeWithMatchPhrase(assetGroup, null, mustFilter, mustNotFilter, shouldFilter, null, mustTermsFilter, matchPhrasePrefix); } catch (Exception e) { throw new DataException(e); } }  JsonArray getUntaggedIssuesByapplicationFromES(String assetGroup,
            String mandatoryTags, String searchText, int from, int size); List<Map<String, Object>> getRuleParamsFromDbByPolicyId(
            String policyId); Long getUntaggedIssues(String assetGroup, String mandatoryTag); List<Map<String, Object>> getRuleTargetTypesFromDbByPolicyId(
            String policyId); String getUntaggedTargetTypeIssues(
            UntaggedTargetTypeRequest request, List<String> tagsList); @Override String getTaggingByApplication(String ag, String targetType);  }### Answer:
@Test public void getUntaggedIssuesTest() throws Exception { long untaggedAssets; when( elasticSearchRepository.getTotalDistributionForIndexAndTypeWithMatchPhrase(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyString(), anyObject(), anyObject())) .thenReturn(5000l); untaggedAssets = taggingRepositoryImpl.getUntaggedIssues("aws-all", "Application,Environmnet"); assertTrue(untaggedAssets > 0); untaggedAssets = taggingRepositoryImpl.getUntaggedIssues("aws-all", null); assertTrue(untaggedAssets > 0); when( elasticSearchRepository.getTotalDistributionForIndexAndTypeWithMatchPhrase(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyString(), anyObject(), anyObject())).thenThrow( new DataException()); assertThatThrownBy(() -> taggingRepositoryImpl.getUntaggedIssues("aws-all", "Application,Environmnet")) .isInstanceOf(DataException.class); taggingRepositoryImpl.init(); }