@Test public void shouldSelectAllAuthorsAsMap() throws Exception { SqlSession session = sqlMapper.openSession(TransactionIsolationLevel.SERIALIZABLE); try { final Map<Integer, Author> authors = session.selectMap( "org.apache.ibatis.domain.blog.mappers.AuthorMapper.selectAllAuthors", "id"); assertEquals(2, authors.size()); for (Map.Entry<Integer, Author> authorEntry : authors.entrySet()) { assertEquals(authorEntry.getKey(), (Integer) authorEntry.getValue().getId()); } } finally { session.close(); } }