Example usage for org.springframework.data.rest.webmvc.jpa Person setHeight

List of usage examples for org.springframework.data.rest.webmvc.jpa Person setHeight

Introduction

In this page you can find the example usage for org.springframework.data.rest.webmvc.jpa Person setHeight.

Prototype

public void setHeight(int height) 

Source Link

Usage

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

/**
 * @see DATAREST-117//from  ww  w.  j  a v  a  2 s .c om
 */
@Test
public void createPersonThenVerifyIgnoredAttributesDontExist() throws Exception {

    Link peopleLink = client.discoverUnique("people");
    ObjectMapper mapper = new ObjectMapper();
    Person frodo = new Person("Frodo", "Baggins");
    frodo.setAge(77);
    frodo.setHeight(42);
    frodo.setWeight(75);
    String frodoString = mapper.writeValueAsString(frodo);

    MockHttpServletResponse response = postAndGet(peopleLink, frodoString, MediaType.APPLICATION_JSON);

    assertJsonPathEquals("$.firstName", "Frodo", response);
    assertJsonPathEquals("$.lastName", "Baggins", response);
    assertJsonPathDoesntExist("$.age", response);
    assertJsonPathDoesntExist("$.height", response);
    assertJsonPathDoesntExist("$.weight", response);
}