Package org.springframework.hateoas

Examples of org.springframework.hateoas.Link


    // Link found in header
    List<String> linkHeader = wrapper.getHeaders().get("Link");
    assertThat(linkHeader, hasSize(1));

    Link link = Link.valueOf(linkHeader.get(0));
    assertThat(link, is(LINK));
  }
View Full Code Here


  JaxRsLinkBuilderFactory factory = new JaxRsLinkBuilderFactory();

  @Test
  public void createsLinkToServiceRoot() {

    Link link = factory.linkTo(PersonServiceImpl.class).withSelfRel();

    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), endsWith("/people"));
  }
View Full Code Here

  }

  @Test
  public void createsLinkToParameterizedServiceRoot() {

    Link link = factory.linkTo(PersonsAddressesService.class, 15).withSelfRel();

    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), endsWith("/people/15/addresses"));
  }
View Full Code Here

public class ControllerLinkBuilderUnitTest extends TestUtils {

  @Test
  public void createsLinkToControllerRoot() {

    Link link = linkTo(PersonControllerImpl.class).withSelfRel();
    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), Matchers.endsWith("/people"));
  }
View Full Code Here

   * @see #96
   */
  @Test
  public void createsLinkToParameterizedServiceRootWithUrlEncoding() {

    Link link = factory.linkTo(PersonsAddressesService.class, "with blank").withSelfRel();

    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), endsWith("/people/with%20blank/addresses"));
  }
View Full Code Here

  }

  @Test
  public void createsLinkToParameterizedControllerRoot() {

    Link link = linkTo(PersonsAddressesController.class, 15).withSelfRel();
    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), endsWith("/people/15/addresses"));
  }
View Full Code Here

   * @see #70
   */
  @Test
  public void createsLinkToMethodOnParameterizedControllerRoot() {

    Link link = linkTo(methodOn(PersonsAddressesController.class, 15).getAddressesForCountry("DE")).withSelfRel();
    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), endsWith("/people/15/addresses/DE"));
  }
View Full Code Here

  }

  @Test
  public void createsLinkToSubResource() {

    Link link = linkTo(PersonControllerImpl.class).slash("something").withSelfRel();
    assertThat(link.getRel(), is(Link.REL_SELF));
    assertThat(link.getHref(), endsWith("/people/something"));
  }
View Full Code Here

  }

  @Test
  public void createsLinkWithCustomRel() {

    Link link = linkTo(PersonControllerImpl.class).withRel(Link.REL_NEXT);
    assertThat(link.getRel(), is(Link.REL_NEXT));
    assertThat(link.getHref(), endsWith("/people"));
  }
View Full Code Here

  }

  @Test
  public void createsLinkToUnmappedController() {

    Link link = linkTo(UnmappedController.class).withSelfRel();
    assertThat(link.getHref(), is("http://localhost"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.hateoas.Link

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.