Example usage for org.springframework.data.rest.tests.mongodb Profile setType

List of usage examples for org.springframework.data.rest.tests.mongodb Profile setType

Introduction

In this page you can find the example usage for org.springframework.data.rest.tests.mongodb Profile setType.

Prototype

public Profile setType(String type) 

Source Link

Usage

From source file:org.springframework.data.rest.tests.mongodb.MongoWebTests.java

@Before
public void populateProfiles() {

    mapper.setSerializationInclusion(Include.NON_NULL);

    Profile twitter = new Profile();
    twitter.setPerson(1L);//from w  w w .j a va 2 s  . c  om
    twitter.setType("Twitter");

    Profile linkedIn = new Profile();
    linkedIn.setPerson(1L);
    linkedIn.setType("LinkedIn");

    repository.save(Arrays.asList(twitter, linkedIn));

    Address address = new Address();
    address.street = "ETagDoesntMatchExceptionUnitTests";
    address.zipCode = "Bar";

    User thomas = new User();
    thomas.firstname = "Thomas";
    thomas.lastname = "Darimont";
    thomas.address = address;

    userRepository.save(thomas);

    User oliver = new User();
    oliver.firstname = "Oliver";
    oliver.lastname = "Gierke";
    oliver.address = address;
    oliver.colleagues = Arrays.asList(thomas);
    userRepository.save(oliver);

    thomas.colleagues = Arrays.asList(oliver);
    userRepository.save(thomas);
}