### Question:
RtcDefectAdapter implements DefectAdapter { String buildDefectsQueryUrl(long projectId, String filter, int batchSize) { final List<String> workItemTypes = settingService.getList(projectId, Settings.DEFECT_RTC_WORK_ITEM_TYPES); final String typeFilter = toFilter("type/id", workItemTypes.stream() .map(t -> "'" + t.toLowerCase() + "'") .collect(Collectors.toList())); String fullFilters = "(" + typeFilter + ") and (" + filter + ")"; final String fields = "work" + "item/workItem[" + fullFilters + "]/(id|state/name|resolutionDate)"; final String rootUrl = settingService.get(projectId, Settings.DEFECT_RTC_ROOT_URL); final String workItemResourcePath = settingService.get(projectId, Settings.DEFECT_RTC_WORK_ITEM_RESOURCE_PATH); return rootUrl + workItemResourcePath + "?fields=" + fields + "&size=" + batchSize; } @Autowired  RtcDefectAdapter(SettingService settingService,
                            RestTemplateBuilder restTemplateBuilder,
                            RtcDateTimeAdapter rtcDateTimeAdapter,
                            SettingProviderService settingProviderService); @Override List<Defect> getStatuses(long projectId, List<String> ids); @Override List<Defect> getChangedDefects(long projectId, Date since); @Override boolean isValidId(long projectId, String id); @Override String getIdFormatHint(long projectId); @Override String getCode(); @Override String getName(); @Override List<SettingDTO> getSettingDefinitions();  }### Answer:
@Test public void buildDefectsQueryUrl_should_work() { long aProjectId = 42; when(settingService.get(aProjectId, Settings.DEFECT_RTC_ROOT_URL)).thenReturn("url/"); when(settingService.get(aProjectId, Settings.DEFECT_RTC_WORK_ITEM_RESOURCE_PATH)).thenReturn("path"); when(settingService.getList(aProjectId, Settings.DEFECT_RTC_WORK_ITEM_TYPES)) .thenReturn(Arrays.asList("t1", "T2")); String filter = "FILTER"; int batchSize = 11; String url = cut.buildDefectsQueryUrl(aProjectId, filter, batchSize); assertThat(url).isEqualTo("url/path?fields=work" + "item/workItem[(type/id='t1' or type/id='t2') and (FILTER)]/(id|state/name|resolutionDate)&size=11"); }