Package org.springframework.data.jpa.domain.sample

Examples of org.springframework.data.jpa.domain.sample.User


  User ollie, tom;

  @Before
  public void setup() {

    ollie = new User("Oliver", "Gierke", "ogierke@gopivotal.com");
    tom = new User("Thomas", "Darimont", "tdarimont@gopivotal.com");
  }
View Full Code Here


  Role role;

  @Before
  public void setup() {

    tom = new User("Thomas", "Darimont", "tdarimont@example.org");
    role = new Role("Developer");
    em.persist(role);
    tom.getRoles().add(role);
  }
View Full Code Here

  Role adminRole;

  @Before
  public void setUp() throws Exception {

    firstUser = new User("Oliver", "Gierke", "gierke@synyx.de");
    firstUser.setAge(28);
    secondUser = new User("Joachim", "Arrasz", "arrasz@synyx.de");
    secondUser.setAge(35);
    Thread.sleep(10);
    thirdUser = new User("Dave", "Matthews", "no@email.com");
    thirdUser.setAge(43);
    fourthUser = new User("kevin", "raymond", "no@gmail.com");
    fourthUser.setAge(31);
    adminRole = new Role("admin");

    SampleSecurityContextHolder.clear();
  }
View Full Code Here

  @Test
  public void testRead() throws Exception {

    flushTestUsers();

    User foundPerson = repository.findOne(id);
    assertThat(firstUser.getFirstname(), is(foundPerson.getFirstname()));
  }
View Full Code Here

  @Test
  public void testUpdate() {

    flushTestUsers();

    User foundPerson = repository.findOne(id);
    foundPerson.setLastname("Schlicht");

    User updatedPerson = repository.findOne(id);
    assertThat(updatedPerson.getFirstname(), is(foundPerson.getFirstname()));
  }
View Full Code Here

  @Test
  public void testFindByEmailAddress() throws Exception {

    flushTestUsers();

    User byName = repository.findByEmailAddress("gierke@synyx.de");

    assertThat(byName, is(notNullValue()));
    assertThat(byName, is(firstUser));
  }
View Full Code Here

    // Persist
    flushTestUsers();

    // Fetches first user from database
    User firstReferenceUser = repository.findOne(firstUser.getId());
    assertThat(firstReferenceUser, is(firstUser));

    // Fetch colleagues and assert link
    Set<User> colleagues = firstReferenceUser.getColleagues();
    assertThat(colleagues.size(), is(1));
    assertThat(colleagues.contains(secondUser), is(true));
  }
View Full Code Here

  public void testMergingCascadesCollegueas() {

    firstUser.addColleague(secondUser);
    flushTestUsers();

    firstUser.addColleague(new User("Florian", "Hopf", "hopf@synyx.de"));
    firstUser = repository.save(firstUser);

    User reference = repository.findOne(firstUser.getId());
    Set<User> colleagues = reference.getColleagues();

    assertThat(colleagues, is(notNullValue()));
    assertThat(colleagues.size(), is(2));
  }
View Full Code Here

  @Test
  public void testCountsCorrectly() {

    long count = repository.count();

    User user = new User();
    user.setEmailAddress("gierke@synyx.de");
    repository.save(user);

    assertThat(repository.count() == count + 1, is(true));
  }
View Full Code Here

  }

  @Test
  public void testInvocationOfCustomImplementation() {

    repository.someCustomMethod(new User());
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.domain.sample.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.