刘光辉
119 分钟以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package jnpf.dmsMapper;
 
import org.apache.ibatis.builder.xml.XMLMapperBuilder;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.Configuration;
import org.junit.jupiter.api.Test;
import java.io.InputStream;
import static org.junit.jupiter.api.Assertions.*;
 
class DmsWenjianDayinQuerenMapperXmlTest {
    @Test
    void confirmationQueriesParseWithExplicitMappings() throws Exception {
        String resource = "mapper/DmsWenjianDayinQuerenMapper.xml";
        Configuration config = new Configuration();
        try (InputStream input = Resources.getResourceAsStream(resource)) {
            new XMLMapperBuilder(input, config, resource, config.getSqlFragments()).parse();
        }
        String prefix = DmsWenjianDayinQuerenMapper.class.getName();
        assertTrue(config.hasStatement(prefix + ".insertConfirmation"));
        var map = config.getMappedStatement(prefix + ".selectConfirmation").getResultMaps().get(0);
        assertEquals(Boolean.FALSE, map.getAutoMapping());
        assertTrue(map.getResultMappings().stream().anyMatch(m -> "dayin_renwu_id".equals(m.getColumn()) && "taskId".equals(m.getProperty())));
        var version = config.getMappedStatement(prefix + ".selectTaskVersion").getResultMaps().get(0);
        assertEquals(Boolean.FALSE, version.getAutoMapping());
        assertTrue(version.getResultMappings().stream().anyMatch(m -> "fileVersionId".equals(m.getProperty())));
    }
}