1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.session.defaults;
17
18 import java.io.Reader;
19
20 import org.apache.ibatis.BaseDataTest;
21 import org.apache.ibatis.io.Resources;
22 import org.apache.ibatis.session.SqlSession;
23 import org.apache.ibatis.session.SqlSessionFactory;
24 import org.assertj.core.api.Assertions;
25 import org.junit.Test;
26
27 public class ExtendedSqlSessionFactoryTest extends BaseDataTest {
28
29 @Test
30 public void testCanUseExtendedSqlSessionUsingDefaults() throws Exception {
31 createBlogDataSource();
32
33 final String resource = "org/apache/ibatis/builder/MapperConfig.xml";
34 final Reader reader = Resources.getResourceAsReader(resource);
35
36 SqlSessionFactory sessionFactory = new ExtendedSqlSessionFactoryBuilder().build(reader);
37 Assertions.assertThat(sessionFactory).isNotNull();
38
39 try (SqlSession sqlSession = sessionFactory.openSession()) {
40 Assertions.assertThat(sqlSession).isNotNull().isInstanceOf(ExtendedSqlSession.class);
41 }
42 }
43 }