Package com.nurkiewicz.jdbcrepository.repositories

Examples of com.nurkiewicz.jdbcrepository.repositories.Comment


  }

  @Test
  public void shouldGenerateKey() throws Exception {
    //given
    final Comment comment = new Comment(someUser, "Some content", new Date(), 0);

    //when
    repository.save(comment);

    //then
    assertThat(comment.getId()).isNotNull();
  }
View Full Code Here


  }

  @Test
  public void shouldGenerateSubsequentIds() throws Exception {
    //given
    final Comment firstComment = new Comment(someUser, "Some content", new Date(), 0);
    final Comment secondComment = new Comment(someUser, "Some content", new Date(), 0);

    //when
    repository.save(firstComment);
    repository.save(secondComment);

    //then

    assertThat(firstComment.getId()).isLessThan(secondComment.getId());
  }
View Full Code Here

  @Test
  public void shouldUpdateCommentByGeneratedId() throws Exception {
    //given
    final Date oldDate = new Date(100000000);
    final Date newDate = new Date(200000000);
    final Comment comment = repository.save(new Comment(someUser, "Some content", oldDate, 0));
    final int id = comment.getId();

    //when
    final Comment updatedComment = repository.save(new Comment(id, someUser, "New content", newDate, 1));

    //then
    assertThat(repository.count()).isEqualTo(1);
    assertThat(updatedComment).isEqualTo(new Comment(id, someUser, "New content", newDate, 1));
  }
View Full Code Here

TOP

Related Classes of com.nurkiewicz.jdbcrepository.repositories.Comment

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.