DevfileServiceLinksInjector { public UserDevfileDto injectLinks(UserDevfileDto userDevfileDto, ServiceContext serviceContext) { return userDevfileDto.withLinks( ImmutableList.of( LinksHelper.createLink( HttpMethod.GET, serviceContext .getBaseUriBuilder() .clone() .path(DevfileService.class) .path(DevfileService.class, "getById") .build(userDevfileDto.getId()) .toString(), null, APPLICATION_JSON, Constants.LINK_REL_SELF))); }  UserDevfileDto injectLinks(UserDevfileDto userDevfileDto, ServiceContext serviceContext);  }
@Test public void shouldInjectLinks() { final UserDevfileDto userDevfileDto = DtoFactory.newDto(UserDevfileDto.class).withId("id123"); DevfileServiceLinksInjector linksInjector = new DevfileServiceLinksInjector(); final UserDevfileDto withLinks = linksInjector.injectLinks(userDevfileDto, context); assertEquals(withLinks.getLinks().size(), 1); assertNotNull(withLinks.getLink(Constants.LINK_REL_SELF)); assertEquals(withLinks.getLinks().get(0).getMethod(), HttpMethod.GET); assertEquals(withLinks.getLinks().get(0).getHref(), URI_BASE + SERVICE_PATH + "/id123"); assertEquals(withLinks.getLinks().get(0).getProduces(), MediaType.APPLICATION_JSON); }