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

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

Introduction

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

Prototype

public void setWeight(int weight) 

Source Link

Usage

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

/**
 * @see DATAREST-117/*  w  ww. j  av a 2s. c  o  m*/
 */
@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);
}