Package domain.blog.mappers

Examples of domain.blog.mappers.AuthorMapper.insertAuthor()


  public void shouldInsertAuthorUsingMapperClass() throws Exception {
    SqlSession session = sqlMapper.openSession();
    try {
      AuthorMapper mapper = session.getMapper(AuthorMapper.class);
      Author expected = new Author(500, "cbegin", "******", "cbegin@somewhere.com", "Something...", null);
      mapper.insertAuthor(expected);
      Author actual = mapper.selectAuthor(500);
      assertNotNull(actual);
      assertEquals(expected.getId(), actual.getId());
      assertEquals(expected.getUsername(), actual.getUsername());
      assertEquals(expected.getPassword(), actual.getPassword());
View Full Code Here


  @Test
  public void shouldInsertAuthorUsingMapperClass() throws Exception {
    AuthorMapper mapper = manager.getMapper(AuthorMapper.class);
    Author expected = new Author(500, "cbegin", "******", "cbegin@somewhere.com", "Something...", null);
    mapper.insertAuthor(expected);
    Author actual = mapper.selectAuthor(500);
    assertNotNull(actual);
    assertEquals(expected.getId(), actual.getId());
    assertEquals(expected.getUsername(), actual.getUsername());
    assertEquals(expected.getPassword(), actual.getPassword());
View Full Code Here

  public void shouldCommitInsertedAuthor() throws Exception {
    try {
      manager.startManagedSession();
      AuthorMapper mapper = manager.getMapper(AuthorMapper.class);
      Author expected = new Author(500, "cbegin", "******", "cbegin@somewhere.com", "Something...", null);
      mapper.insertAuthor(expected);
      manager.commit();
      Author actual = mapper.selectAuthor(500);
      assertNotNull(actual);
    } finally {
      manager.close();
View Full Code Here

  public void shouldRollbackInsertedAuthor() throws Exception {
    try {
      manager.startManagedSession();
      AuthorMapper mapper = manager.getMapper(AuthorMapper.class);
      Author expected = new Author(500, "cbegin", "******", "cbegin@somewhere.com", "Something...", null);
      mapper.insertAuthor(expected);
      manager.rollback();
      Author actual = mapper.selectAuthor(500);
      assertNull(actual);
    } finally {
      manager.close();
View Full Code Here

  @Test
  public void shouldImplicitlyRollbackInsertedAuthor() throws Exception {
    manager.startManagedSession();
    AuthorMapper mapper = manager.getMapper(AuthorMapper.class);
    Author expected = new Author(500, "cbegin", "******", "cbegin@somewhere.com", "Something...", null);
    mapper.insertAuthor(expected);
    manager.close();
    Author actual = mapper.selectAuthor(500);
    assertNull(actual);
  }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.