@Test public void testGetMeasureNamesGroupByOrg() throws Exception { GriffinMeasure measure = createGriffinMeasure("measure"); when(measureRepo.findByDeleted(false)).thenReturn(Arrays .asList(measure)); Map<String, List<String>> map = service.getMeasureNamesGroupByOrg(); assertThat(map.size()).isEqualTo(1); }
@Override public Map<String, List<String>> getMeasureNamesGroupByOrg() { Map<String, List<String>> orgWithMetricsMap = new HashMap<>(); List<GriffinMeasure> measures = measureRepo.findByDeleted(false); for (Measure measure : measures) { String orgName = measure.getOrganization(); orgName = orgName == null ? "null" : orgName; String measureName = measure.getName(); List<String> measureList = orgWithMetricsMap.getOrDefault(orgName, new ArrayList<>()); measureList.add(measureName); orgWithMetricsMap.put(orgName, measureList); } return orgWithMetricsMap; }
MeasureOrgServiceImpl implements MeasureOrgService { @Override public Map<String, List<String>> getMeasureNamesGroupByOrg() { Map<String, List<String>> orgWithMetricsMap = new HashMap<>(); List<GriffinMeasure> measures = measureRepo.findByDeleted(false); for (Measure measure : measures) { String orgName = measure.getOrganization(); orgName = orgName == null ? "null" : orgName; String measureName = measure.getName(); List<String> measureList = orgWithMetricsMap.getOrDefault(orgName, new ArrayList<>()); measureList.add(measureName); orgWithMetricsMap.put(orgName, measureList); } return orgWithMetricsMap; } }
MeasureOrgServiceImpl implements MeasureOrgService { @Override public Map<String, List<String>> getMeasureNamesGroupByOrg() { Map<String, List<String>> orgWithMetricsMap = new HashMap<>(); List<GriffinMeasure> measures = measureRepo.findByDeleted(false); for (Measure measure : measures) { String orgName = measure.getOrganization(); orgName = orgName == null ? "null" : orgName; String measureName = measure.getName(); List<String> measureList = orgWithMetricsMap.getOrDefault(orgName, new ArrayList<>()); measureList.add(measureName); orgWithMetricsMap.put(orgName, measureList); } return orgWithMetricsMap; }  }
MeasureOrgServiceImpl implements MeasureOrgService { @Override public Map<String, List<String>> getMeasureNamesGroupByOrg() { Map<String, List<String>> orgWithMetricsMap = new HashMap<>(); List<GriffinMeasure> measures = measureRepo.findByDeleted(false); for (Measure measure : measures) { String orgName = measure.getOrganization(); orgName = orgName == null ? "null" : orgName; String measureName = measure.getName(); List<String> measureList = orgWithMetricsMap.getOrDefault(orgName, new ArrayList<>()); measureList.add(measureName); orgWithMetricsMap.put(orgName, measureList); } return orgWithMetricsMap; }  @Override List<String> getOrgs(); @Override List<String> getMetricNameListByOrg(String org); @Override Map<String, List<String>> getMeasureNamesGroupByOrg(); @Override Map<String, Map<String, List<Map<String, Object>>>> getMeasureWithJobDetailsGroupByOrg(Map<String,
        List<Map<String, Object>>> jobDetails); }
MeasureOrgServiceImpl implements MeasureOrgService { @Override public Map<String, List<String>> getMeasureNamesGroupByOrg() { Map<String, List<String>> orgWithMetricsMap = new HashMap<>(); List<GriffinMeasure> measures = measureRepo.findByDeleted(false); for (Measure measure : measures) { String orgName = measure.getOrganization(); orgName = orgName == null ? "null" : orgName; String measureName = measure.getName(); List<String> measureList = orgWithMetricsMap.getOrDefault(orgName, new ArrayList<>()); measureList.add(measureName); orgWithMetricsMap.put(orgName, measureList); } return orgWithMetricsMap; }  @Override List<String> getOrgs(); @Override List<String> getMetricNameListByOrg(String org); @Override Map<String, List<String>> getMeasureNamesGroupByOrg(); @Override Map<String, Map<String, List<Map<String, Object>>>> getMeasureWithJobDetailsGroupByOrg(Map<String,
        List<Map<String, Object>>> jobDetails);  }