Example usage for org.springframework.hateoas Links valueOf

List of usage examples for org.springframework.hateoas Links valueOf

Introduction

In this page you can find the example usage for org.springframework.hateoas Links valueOf.

Prototype

@Deprecated
public static Links valueOf(String source) 

Source Link

Document

Creates a Links instance from the given RFC5988-compatible link format.

Usage

From source file:org.springframework.data.rest.webmvc.jpa.JpaWebTests.java

/**
 * @see DATAREST-658//  w w  w.j  a v  a 2s . c  o  m
 */
@Test
public void returnsLinkHeadersForHeadRequestToItemResource() throws Exception {

    MockHttpServletResponse response = client.request(client.discoverUnique("people"));
    String personHref = JsonPath.read(response.getContentAsString(), "$._embedded.people[0]._links.self.href");

    response = mvc.perform(head(personHref))//
            .andExpect(status().isNoContent())//
            .andReturn().getResponse();

    Links links = Links.valueOf(response.getHeader("Link"));
    assertThat(links.hasLink("self"), is(true));
    assertThat(links.hasLink("person"), is(true));
}