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

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

Introduction

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

Prototype

@NotNull
    public void setLastName(String lastName) 

Source Link

Usage

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

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

    Link peopleLink = client.discoverUnique("people");

    Person frodo = new Person();
    frodo.setFirstName("Frodo");
    frodo.setLastName(null);

    MockHttpServletResponse response = postAndGet(peopleLink, mapper.writeValueAsString(frodo),
            MediaType.APPLICATION_JSON);
    String responseBody = response.getContentAsString();

    assertEquals(JsonPath.read(responseBody, "$.firstName"), "Frodo");
    assertNull(JsonPath.read(responseBody, "$.lastName"));
}