### Question:
TrendRepositoryImpl implements TrendRepository, Constants { @Override public List<Map<String, Object>> getComplianceTrendProgress( String assetGroup, LocalDate fromDate, String domain, Set<String> ruleCat) throws DataException { List<String> categoryList = new ArrayList<>(ruleCat); Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword("ag"), assetGroup); mustFilter.put(CommonUtils.convertAttributetoKeyword(DOMAIN), domain); Map<String, Object> rangeMap = new HashMap<>(); rangeMap.put("gte", fromDate.format(DateTimeFormatter.ISO_DATE)); Map<String, Object> dateRangeMap = new HashMap<>(); dateRangeMap.put("date", rangeMap); mustFilter.put(RANGE, dateRangeMap); categoryList.add("date"); categoryList.add("overall"); try{ return elasticSearchRepository.getSortedDataFromES(AG_STATS, "compliance", mustFilter, null, null, categoryList, null,null); }catch(Exception e){ throw new DataException(e); } }  @Override List<Map<String, Object>> getComplianceTrendProgress(
            String assetGroup, LocalDate fromDate, String domain,
            Set<String> ruleCat); @Override List<Map<String, Object>> getTrendProgress(String assetGroup,
            String ruleId, LocalDate startDate, LocalDate endDate,
            String trendCategory); @Override List<Map<String, Object>> getTrendIssues(String assetGroup,
            LocalDate startDate, LocalDate endDate, Map<String, String> filter,
            Set<String> ruleSev);  }### Answer:
@Test public void getComplianceTrendProgressTest() throws Exception { List<Map<String, Object>> compliantTrendProgress = new ArrayList<>(); Map<String, Object> complianceTrend = new HashMap<>(); complianceTrend.put("date", 01 - 10 - 2018); complianceTrend.put("compliance", 10); compliantTrendProgress.add(complianceTrend); complianceTrend.put("date", 02 - 10 - 2018); complianceTrend.put("compliance", 35); compliantTrendProgress.add(complianceTrend); Set<String> ruleCat = new HashSet<>(); ruleCat.add("security"); ruleCat.add("governance"); when( elasticSearchRepository.getSortedDataFromES(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(compliantTrendProgress); trendRepositoryImpl.getComplianceTrendProgress("aws-all", LocalDate.now(), "test", ruleCat); when( elasticSearchRepository.getSortedDataFromES(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenThrow(new RuntimeException()); assertThatThrownBy( () -> trendRepositoryImpl.getComplianceTrendProgress("aws-all", LocalDate.now(), "test", ruleCat)) .isInstanceOf(DataException.class); }