### Question:
GuiFragmentService implements IGuiFragmentService { @Override public PagedMetadata<ComponentUsageEntity> getComponentUsageDetails(String componentCode, RestListRequest restListRequest) { List<ComponentUsageEntity> componentUsageEntityList = new ArrayList<>(); GuiFragmentDto fragmentDto = this.getGuiFragment(componentCode); if (null != fragmentDto.getWidgetType()) { componentUsageEntityList.add(new ComponentUsageEntity(ComponentUsageEntity.TYPE_WIDGET, fragmentDto.getWidgetTypeCode())); } if (null != fragmentDto.getFragments()) { List<ComponentUsageEntity> fragmentList = fragmentDto.getFragments().stream() .map(fragmentRef -> new ComponentUsageEntity(ComponentUsageEntity.TYPE_FRAGMENT, fragmentRef.getCode())) .collect(Collectors.toList()); componentUsageEntityList.addAll(fragmentList); } if (null != fragmentDto.getPageModels()) { List<ComponentUsageEntity> pageModelList = fragmentDto.getPageModels().stream() .map(pageModelRef -> new ComponentUsageEntity(ComponentUsageEntity.TYPE_PAGE_TEMPLATE, pageModelRef.getCode())) .collect(Collectors.toList()); componentUsageEntityList.addAll(pageModelList); } return pagedMetadataMapper.getPagedResult(restListRequest, componentUsageEntityList); }  void setGuiFragmentManager(IGuiFragmentManager guiFragmentManager); void setDtoBuilder(IDtoBuilder<GuiFragment, GuiFragmentDto> dtoBuilder); void setDtoSmallBuilder(IDtoBuilder<GuiFragment, GuiFragmentDtoSmall> dtoSmallBuilder); @Override PagedMetadata<GuiFragmentDtoSmall> getGuiFragments(RestListRequest restListReq); @Override GuiFragmentDto getGuiFragment(String code); @Override GuiFragmentDto addGuiFragment(GuiFragmentRequestBody guiFragmentRequest); @Override GuiFragmentDto updateGuiFragment(GuiFragmentRequestBody guiFragmentRequest); @Override void removeGuiFragment(String guiFragmentCode); @Override List<String> getPluginCodes(); @Override Integer getComponentUsage(String componentCode); @Override PagedMetadata<ComponentUsageEntity> getComponentUsageDetails(String componentCode, RestListRequest restListRequest);  }### Answer:
@Test public void getFragmentUsageTest() throws Exception { Lang lang = new Lang(); lang.setCode("IT"); when(langManager.getDefaultLang()).thenReturn(lang); GuiFragment fragment = FragmentMockHelper.mockGuiFragment(); GuiFragmentDto fragmentDto = FragmentMockHelper.mockGuiFragmentDto(fragment, langManager); mockPagedMetadata(fragment, fragmentDto, 1, 1, 100, 5); PagedMetadata<ComponentUsageEntity> componentUsageDetails = guiFragmentService.getComponentUsageDetails(fragment.getCode(), new PageSearchRequest(PageMockHelper.PAGE_CODE)); GuiFragmentAssertionHelper.assertUsageDetails(componentUsageDetails); }