@Test public void shouldGroupByPropertyMakeSubLevelByDot() { Map<String, Object> map = new HashMap<>(); map.put("test.key1", "value1"); map.put("test.key2", "value2"); Map<String, Object> res = tested.groupByProperty(map); Assert.assertTrue(res.containsKey("test")); Map<String, Object> subLevel = (Map<String, Object>) res.get("test"); Assert.assertTrue(subLevel.containsKey("key1")); Assert.assertTrue(subLevel.containsKey("key2")); Assert.assertEquals("value1", subLevel.get("key1")); Assert.assertEquals("value2", subLevel.get("key2")); }
protected Map<String, Object> groupByProperty(Map<String, Object> data) { Map<String, Object> map = new HashMap<>(); data.entrySet().forEach(entry -> addToMap(map, entry.getKey(), entry.getValue())); return map; }
DefaultValueService { protected Map<String, Object> groupByProperty(Map<String, Object> data) { Map<String, Object> map = new HashMap<>(); data.entrySet().forEach(entry -> addToMap(map, entry.getKey(), entry.getValue())); return map; } }
DefaultValueService { protected Map<String, Object> groupByProperty(Map<String, Object> data) { Map<String, Object> map = new HashMap<>(); data.entrySet().forEach(entry -> addToMap(map, entry.getKey(), entry.getValue())); return map; } @Autowired  DefaultValueService(@NonNull final DefaultValueRepository repository,
                        @NonNull final ProjectRepository projectRepository); }
DefaultValueService { protected Map<String, Object> groupByProperty(Map<String, Object> data) { Map<String, Object> map = new HashMap<>(); data.entrySet().forEach(entry -> addToMap(map, entry.getKey(), entry.getValue())); return map; } @Autowired  DefaultValueService(@NonNull final DefaultValueRepository repository,
                        @NonNull final ProjectRepository projectRepository); Map<String, Object> getValues(DefaultValue.DefaultValueType type, Long projectId); Map<String, Object> getValues(DefaultValue.DefaultValueType type, String projectSlug); void saveDefaultValues(@NonNull final Project project, @NonNull final U entity); }
DefaultValueService { protected Map<String, Object> groupByProperty(Map<String, Object> data) { Map<String, Object> map = new HashMap<>(); data.entrySet().forEach(entry -> addToMap(map, entry.getKey(), entry.getValue())); return map; } @Autowired  DefaultValueService(@NonNull final DefaultValueRepository repository,
                        @NonNull final ProjectRepository projectRepository); Map<String, Object> getValues(DefaultValue.DefaultValueType type, Long projectId); Map<String, Object> getValues(DefaultValue.DefaultValueType type, String projectSlug); void saveDefaultValues(@NonNull final Project project, @NonNull final U entity);  }