### Question:
TechnologySettingService { @Transactional(readOnly = true) public List<TechnologySettingGroupDTO> getAllGroups(Long projectId) { List<TechnologySettingGroupDTO> groups = getTechnologySettingGroupDefinition(); List<TechnologySetting> savedSettings = technologySettingRepository.findByProjectId(projectId); for (TechnologySettingGroupDTO group : groups) { List<SettingDTO> settings = group.getSettings(); for (SettingDTO setting : settings) { String code = setting.getCode(); Optional<String> value = getValueFromSavedSettings(savedSettings, code); value.ifPresent(setting::setValue); } } return groups; }  @Transactional(readOnly = true) List<TechnologySettingGroupDTO> getAllGroups(Long projectId); @Transactional(readOnly = true) Optional<String> getSettingValue(Long projectId, AvailableTechnologySettings availableTechnologySettings); @Transactional void update(Long projectId, String code, Technology technology, String newValue);  }### Answer:
@Test public void getAllGroups_returnAllGroups() { Long projectId = 1L; TechnologySetting technologySetting1 = mock(TechnologySetting.class); TechnologySetting technologySetting2 = mock(TechnologySetting.class); TechnologySetting technologySetting3 = mock(TechnologySetting.class); when(technologySettingRepository.findByProjectId(projectId)).thenReturn( Arrays.asList(technologySetting1, technologySetting2, technologySetting3) ); when(technologySetting1.getCode()).thenReturn(CucumberSettings.REPORT_PATH.getCode()); when(technologySetting1.getValue()).thenReturn("/new/cucumber/path"); when(technologySetting2.getCode()).thenReturn(PostmanSettings.REPORTS_PATH.getCode()); when(technologySetting2.getValue()).thenReturn("/updated/newmann/value"); when(technologySetting3.getCode()).thenReturn("unknown-code"); List<TechnologySettingGroupDTO> technologySettingGroups = technologySettingService.getAllGroups(projectId); assertThat(technologySettingGroups).isNotEmpty(); assertThat(technologySettingGroups) .extracting("technology") .contains( Technology.CUCUMBER, Technology.POSTMAN ); TechnologySettingGroupDTO cucumberGroup = technologySettingGroups.stream() .filter(s -> Technology.CUCUMBER.equals(s.getTechnology())) .findFirst() .get(); assertThat(cucumberGroup.getName()).isEqualTo("Cucumber"); assertThat(cucumberGroup.getSettings()) .hasSize(2) .extracting( "code", "name", "type", "required", "help", "defaultValue", "value" ) .containsOnly( tuple( "report.path", "Cucumber report path", SettingType.STRING, true, "Cucumber reports are extracted from this path. Eg. \"/report.json\", appended to the run's job folder.", "/report.json", "/new/cucumber/path" ), tuple( "step.definitions.path", "Cucumber step definitions path", SettingType.STRING, true, "Cucumber step definitions are extracted from this path. Eg. \" /stepDefinitions.json\", appended to the run's job folder. If not provided, the cycle-definitions will not be downloaded", "/stepDefinitions.json", "/stepDefinitions.json" ) ); TechnologySettingGroupDTO postmanGroup = technologySettingGroups.stream() .filter(s -> Technology.POSTMAN.equals(s.getTechnology())) .findFirst() .get(); assertThat(postmanGroup.getName()).isEqualTo("Postman"); assertThat(postmanGroup.getSettings()) .hasSize(2) .extracting( "code", "name", "type", "required", "help", "defaultValue", "value" ) .containsOnly( tuple( "reports.path", "Newman reports path", SettingType.STRING, true, "Newman reports are extracted from this path. Eg. \"/reports\", appended to the run's jobUrl.", "/reports", "/updated/newmann/value" ), tuple( "result.file.name", "Newman result file name", SettingType.STRING, true, "Newman result is extracted from this file (located in the reports folder). Eg. \"/result.txt\". It shows whether the scenarios were successful or not", "result.txt", "result.txt" ) ); }