### Question:
WorkbasketDefinitionRepresentationModelAssembler implements TaskanaPagingAssembler<Workbasket, WorkbasketDefinitionRepresentationModel> { @NonNull public WorkbasketDefinitionRepresentationModel toModel(@NonNull Workbasket workbasket) { WorkbasketRepresentationModel basket = workbasketAssembler.toModel(workbasket); Collection<WorkbasketAccessItemRepresentationModel> authorizations; Set<String> distroTargets; try { List<WorkbasketAccessItem> workbasketAccessItems = workbasketService.getWorkbasketAccessItems(basket.getWorkbasketId()); authorizations = accessItemAssembler.toCollectionModel(workbasketAccessItems).getContent(); distroTargets = workbasketService.getDistributionTargets(workbasket.getId()).stream() .map(WorkbasketSummary::getId) .collect(Collectors.toSet()); } catch (NotAuthorizedException | WorkbasketNotFoundException e) { throw new SystemException("Caught Exception", e); } WorkbasketDefinitionRepresentationModel repModel = new WorkbasketDefinitionRepresentationModel(); repModel.setWorkbasket(basket); repModel.setAuthorizations(authorizations); repModel.setDistributionTargets(distroTargets); return repModel; } @Autowired  WorkbasketDefinitionRepresentationModelAssembler(
      WorkbasketService workbasketService,
      WorkbasketAccessItemRepresentationModelAssembler accessItemAssembler,
      WorkbasketRepresentationModelAssembler workbasketAssembler); @NonNull WorkbasketDefinitionRepresentationModel toModel(@NonNull Workbasket workbasket); @Override TaskanaPagedModelKeys getProperty();  }### Answer:
@Test void should_ReturnDefinitionEntity_When_ConvertingWorkbasketToDefinition() throws Exception { WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("1", "DOMAIN_A"); String id = "ID1"; workbasket.setId(id); List<WorkbasketAccessItem> workbasketAccessItems = Arrays.asList( workbasketService.newWorkbasketAccessItem(id, "a"), workbasketService.newWorkbasketAccessItem(id, "b")); WorkbasketImpl target1 = (WorkbasketImpl) workbasketService.newWorkbasket("2", "DOMAIN_A"); WorkbasketImpl target2 = (WorkbasketImpl) workbasketService.newWorkbasket("3", "DOMAIN_A"); target1.setId("target1"); target2.setId("target2"); List<WorkbasketSummary> workbasketSummaries = Arrays.asList(target1, target2); Mockito.doReturn(workbasketAccessItems).when(workbasketService).getWorkbasketAccessItems(id); Mockito.doReturn(workbasketSummaries).when(workbasketService).getDistributionTargets(id); Object[] mocks = {workbasketService, workbasketAssembler, accessItemAssembler}; Mockito.clearInvocations(mocks); WorkbasketDefinitionRepresentationModel repModel = assembler.toModel(workbasket); assertThat(repModel).isNotNull(); assertThat(repModel.getWorkbasket()).isNotNull(); assertThat(repModel.getAuthorizations()).hasSize(2); assertThat(repModel.getDistributionTargets()).containsExactlyInAnyOrder("target1", "target2"); InOrder inOrder = Mockito.inOrder(mocks); inOrder.verify(workbasketAssembler).toModel(workbasket); inOrder.verify(workbasketService).getWorkbasketAccessItems(id); inOrder.verify(accessItemAssembler).toCollectionModel(workbasketAccessItems); inOrder.verify(accessItemAssembler, times(2)).toModel(any()); inOrder.verify(workbasketService).getDistributionTargets(id); inOrder.verifyNoMoreInteractions(); Mockito.verifyNoMoreInteractions(mocks); }