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

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

Introduction

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

Prototype

public void setAge(int age) 

Source Link

Usage

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

/**
 * @see DATAREST-117//from w  ww  .j  a  va  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);
}