### Question:
ClusterModelAssembler implements RepresentationModelAssembler<Cluster, EntityModel<Cluster>> { @Override @Nonnull public EntityModel<Cluster> toModel(final Cluster cluster) { final String id = cluster.getId().orElseThrow(IllegalArgumentException::new); final EntityModel<Cluster> clusterModel = new EntityModel<>(cluster); try { clusterModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(ClusterRestController.class) .getCluster(id) ).withSelfRel() ); clusterModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(ClusterRestController.class) .getCommandsForCluster(id, null) ).withRel(COMMANDS_LINK) ); } catch (final NotFoundException ge) { throw new RuntimeException(ge); } return clusterModel; }  @Override @Nonnull EntityModel<Cluster> toModel(final Cluster cluster);  }### Answer:
@Test void canConvertToModel() { final EntityModel<Cluster> model = this.assembler.toModel(this.cluster); Assertions.assertThat(model.getLinks()).hasSize(2); Assertions.assertThat(model.getLink("self")).isPresent(); Assertions.assertThat(model.getLink("commands")).isPresent(); }