Package com.nurkiewicz.jdbcrepository.repositories

Examples of com.nurkiewicz.jdbcrepository.repositories.User


  @Test
  public void shouldDeleteByEntity() throws Exception {
    //given
    final String someId = "john12";
    final User user = repository.save(user(someId));

    //when
    repository.delete(user);

    //then
View Full Code Here


  }

  @Test
  public void shouldSaveMultipleEntities() throws Exception {
    //given
    User john = user("john");
    User alice = user("alice");

    //when
    repository.save(Arrays.asList(john, alice));

    //then
View Full Code Here

  }

  @Test
  public void shouldDeleteMultipleEntities() throws Exception {
    //given
    User john = user("john");
    User alice = user("alice");
    repository.save(Arrays.asList(john, alice));

    //when
    repository.delete(Arrays.asList(john, alice));
View Full Code Here

  }

  @Test
  public void shouldSkipNonListedEntitiesWhenDeletingInBatch() throws Exception {
    //given
    User john = user("john");
    User alice = user("alice");
    final User bobby = user("bobby");
    repository.save(Arrays.asList(john, alice, bobby));

    //when
    repository.delete(Arrays.asList(john, alice));
View Full Code Here

  }

  @Test
  public void shouldSkipNonExistingEntitiesWhenDeletingInBatch() throws Exception {
    //given
    User john = user("john");
    User alice = user("alice");
    final User bobby = user("bobby");
    repository.save(Arrays.asList(john, alice, bobby));

    //when
    repository.delete(Arrays.asList(john, alice, user("bogus")));
View Full Code Here

    super(databasePort);
  }

  @Before
  public void setup() {
    someUser = userRepository.save(new User(SOME_USER, SOME_DATE, -1, false));
  }
View Full Code Here

  }

  @Test
  public void shouldReturnMultipleCommentsAttachedToDifferentUsers() throws Exception {
    //given
    final User firstUser = userRepository.save(new User("First user", SOME_DATE, 10, false));
    final User secondUser = userRepository.save(new User("Second user", SOME_DATE, 20, false));
    final User thirdUser = userRepository.save(new User("Third user", SOME_DATE, 30, false));

    final CommentWithUser first = repository.save(new CommentWithUser(firstUser, "First comment", SOME_TIMESTAMP, 3));
    final CommentWithUser second = repository.save(new CommentWithUser(secondUser, "Second comment", SOME_TIMESTAMP, 2));
    final CommentWithUser third = repository.save(new CommentWithUser(thirdUser, "Third comment", SOME_TIMESTAMP, 1));
View Full Code Here

  }

  @Test
  public void shouldUpdateCommentByAttachingDifferentUser() throws Exception {
    //given
    final User firstUser = userRepository.save(new User("First user", SOME_DATE, 10, false));
    final CommentWithUser comment = repository.save(new CommentWithUser(someUser, "First comment", SOME_TIMESTAMP, 3));

    //when
    comment.setUser(firstUser);
    repository.save(comment);
View Full Code Here

    super(databasePort);
  }

  @Before
  public void setup() {
    userRepository.save(new User(someUser, new Date(), -1, false));
  }
View Full Code Here

    //when
    final List<User> users = tx.execute(new TransactionCallback<List<User>>() {
      @Override
      public List<User> doInTransaction(TransactionStatus status) {
        final User user = new User("john", new Date(), 0, false);
        userRepository.save(user);
        return userRepository.findAll();
      }
    });
View Full Code Here

TOP

Related Classes of com.nurkiewicz.jdbcrepository.repositories.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.