1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.submitted.extendresultmap;
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.apache.ibatis.session.SqlSessionFactoryBuilder;
25 import org.junit.jupiter.api.BeforeAll;
26 import org.junit.jupiter.api.Test;
27
28 class ExtendResultMapTest {
29
30 private static SqlSessionFactory sqlSessionFactory;
31
32 @BeforeAll
33 static void setUp() throws Exception {
34
35 try (Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/extendresultmap/mybatis-config.xml")) {
36 sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
37 }
38
39
40 BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
41 "org/apache/ibatis/submitted/extendresultmap/CreateDB.sql");
42 }
43
44 @Test
45 void shouldGetAUser() {
46 try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
47 TestMapperY mapper = sqlSession.getMapper(TestMapperY.class);
48 mapper.retrieveTestString();
49 }
50 }
51
52 }