### Question:
ProcessInstanceResourceAssembler implements ResourceAssembler<ProcessInstance, Resource<CloudProcessInstance>> { @Override public Resource<CloudProcessInstance> toResource(ProcessInstance processInstance) { CloudProcessInstance cloudProcessInstance = toCloudProcessInstanceConverter.from(processInstance); Link processInstancesRel = linkTo(methodOn(ProcessInstanceControllerImpl.class).getProcessInstances(null)) .withRel("processInstances"); Link selfLink = linkTo(methodOn(ProcessInstanceControllerImpl.class).getProcessInstanceById(cloudProcessInstance.getId())).withSelfRel(); Link variablesLink = linkTo(methodOn(ProcessInstanceVariableControllerImpl.class).getVariables(cloudProcessInstance.getId())).withRel("variables"); Link homeLink = linkTo(HomeControllerImpl.class).withRel("home"); return new Resource<>(cloudProcessInstance, selfLink, variablesLink, processInstancesRel, homeLink); } ProcessInstanceResourceAssembler(ToCloudProcessInstanceConverter toCloudProcessInstanceConverter); @Override Resource<CloudProcessInstance> toResource(ProcessInstance processInstance);  }### Answer:
@Test public void toResourceShouldReturnResourceWithSelfLinkContainingResourceId() { CloudProcessInstance cloudModel = mock(CloudProcessInstance.class); given(cloudModel.getId()).willReturn("my-identifier"); ProcessInstance model = mock(ProcessInstance.class); given(toCloudProcessInstanceConverter.from(model)).willReturn(cloudModel); Resource<CloudProcessInstance> resource = resourceAssembler.toResource(model); Link selfResourceLink = resource.getLink("self"); assertThat(selfResourceLink).isNotNull(); assertThat(selfResourceLink.getHref()).contains("my-identifier"); }