Esempio n. 1
0
 @Test
 public void shouldSelectAllPostsUsingMapperClass() throws Exception {
   SqlSession session = sqlMapper.openSession();
   try {
     BlogMapper mapper = session.getMapper(BlogMapper.class);
     List<Map> posts = mapper.selectAllPosts();
     assertEquals(5, posts.size());
   } finally {
     session.close();
   }
 }
Esempio n. 2
0
 @Test
 public void shouldLimitResultsUsingMapperClass() throws Exception {
   SqlSession session = sqlMapper.openSession();
   try {
     BlogMapper mapper = session.getMapper(BlogMapper.class);
     List<Map> posts = mapper.selectAllPosts(new RowBounds(0, 2), null);
     assertEquals(2, posts.size());
     assertEquals(1, posts.get(0).get("ID"));
     assertEquals(2, posts.get(1).get("ID"));
   } finally {
     session.close();
   }
 }