@Test void canConvertToResource() { final EntityModel<JobSearchResult> model = this.assembler.toModel(this.jobSearchResult); Assertions.assertThat(model.getLinks()).hasSize(1); Assertions.assertThat(model.getLink("self")).isNotNull(); }
@Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(JobRestController.class) .getJob(job.getId()) ).withSelfRel() ); } catch (final GenieException ge) { throw new RuntimeException(ge); } return jobSearchResultModel; }
JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(JobRestController.class) .getJob(job.getId()) ).withSelfRel() ); } catch (final GenieException ge) { throw new RuntimeException(ge); } return jobSearchResultModel; } }
JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(JobRestController.class) .getJob(job.getId()) ).withSelfRel() ); } catch (final GenieException ge) { throw new RuntimeException(ge); } return jobSearchResultModel; }  }
JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(JobRestController.class) .getJob(job.getId()) ).withSelfRel() ); } catch (final GenieException ge) { throw new RuntimeException(ge); } return jobSearchResultModel; }  @Override @Nonnull EntityModel<JobSearchResult> toModel(final JobSearchResult job); }
JobSearchResultModelAssembler implements RepresentationModelAssembler<JobSearchResult, EntityModel<JobSearchResult>> { @Override @Nonnull public EntityModel<JobSearchResult> toModel(final JobSearchResult job) { final EntityModel<JobSearchResult> jobSearchResultModel = new EntityModel<>(job); try { jobSearchResultModel.add( WebMvcLinkBuilder.linkTo( WebMvcLinkBuilder .methodOn(JobRestController.class) .getJob(job.getId()) ).withSelfRel() ); } catch (final GenieException ge) { throw new RuntimeException(ge); } return jobSearchResultModel; }  @Override @Nonnull EntityModel<JobSearchResult> toModel(final JobSearchResult job);  }