### Question:
PatchingRepositoryImpl implements PatchingRepository, Constants { @Override public List<Map<String, Object>> getOnpremResourceInfo(String assetGroup, Map<String, String> filters) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(LATEST, true); mustFilter.put("inScope.keyword", true); Map<String, Object> mustTermsFilter = new HashMap<>(); Map<String, Object> mustNotTermsFilter = new HashMap<>(); Map<String, Object> mustNotFilter = new HashMap<>(); Map<String, Object> mustNotWildCardFilter = new HashMap<>(); if (null != filters && filters.size() > 0) { filters.forEach((key, value) -> mustFilter.put(key, value)); } try{ return elasticSearchRepository .getSortedDataFromESWithMustNotTermsFilter(assetGroup, ONPREMSERVER, mustFilter, mustNotFilter, null, Arrays .asList(RESOURCEID, "ip_address", "host_name", "kernel_release", TAGS_APPLICATION, "tags.Environment"), mustTermsFilter, mustNotTermsFilter, mustNotWildCardFilter, null); } catch(Exception e){ throw new DataException(e); } }  @Override List<Map<String, Object>> getPatchingProgress(String assetGroup,
            LocalDate startDate, LocalDate endDate); @Override List<Map<String, Object>> getIssueInfo(String assetGroup); List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size); @Override List<Map<String, Object>> getInstanceInfo(String assetGroup,
            Map<String, String> filters); @Override List<Map<String, Object>> getExecAndDirectorInfo(); @Override long getInstanceInfoCount(String assetGroup,
            Map<String, String> filters, String searchText); @Override String getAmilAvailDate(int year, int quarter); @Override int getPatchingWindow(); @Override Map<String, Long> getQuartersWithPatchingData(String assetGroup); Map<String, Object> addParentConditionPatching(String targetType); @Override List<Map<String, Object>> getOnpremIssueInfo(String assetGroup); @Override List<Map<String, Object>> getOnpremResourceInfo(String assetGroup,
            Map<String, String> filters); @Override Map<String, Object> getDirectorsAndExcutiveSponsers(String appTag,
            String appType); @Override Map<String, Long> getNonCompliantNumberForAgAndResourceType(
            String assetGroup, String resourceType); @Override List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate,
			LocalDate toDate);  }### Answer:
@Test public void getOnpremResourceInfoTest() throws Exception { List<Map<String, Object>> onpremResourceInfo = new ArrayList<>(); Map<String, Object> resourceInfo = new HashMap<String, Object>(); resourceInfo.put("_resourceId", 12345); resourceInfo.put("application", "appName1"); onpremResourceInfo.add(resourceInfo); Map<String, String> filters = new HashMap<>(); filters.put("resourceType", "onpremserver"); when( elasticSearchRepository.getSortedDataFromESWithMustNotTermsFilter(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(onpremResourceInfo); patchingRepositoryImpl.getOnpremResourceInfo("aws-all", filters); Map<String, String> emptyFilter = new HashMap<>(); patchingRepositoryImpl.getOnpremResourceInfo("aws-all", emptyFilter); patchingRepositoryImpl.getOnpremResourceInfo("aws-all", null); when( elasticSearchRepository.getSortedDataFromESWithMustNotTermsFilter(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenThrow(new RuntimeException()); assertThatThrownBy(() -> patchingRepositoryImpl.getOnpremResourceInfo("aws-all", filters)).isInstanceOf( DataException.class); }