package jnpf.dmsMapper; import org.apache.ibatis.builder.xml.XMLMapperBuilder; import org.apache.ibatis.session.Configuration; import org.junit.jupiter.api.Test; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.*; class DmsBupinghengRetryMapperXmlTest { @Test void parsesAllStatementsAndExplicitlyMapsRetryState() throws Exception { Configuration configuration = new Configuration(); String resource = "mapper/DmsBupinghengRetryMapper.xml"; try (java.io.InputStream input = getClass().getResourceAsStream("/" + resource)) { new XMLMapperBuilder(input, configuration, resource, configuration.getSqlFragments()).parse(); } String ns = "jnpf.dmsMapper.DmsBupinghengRetryMapper."; assertFalse(configuration.getResultMap(ns + "RetryMap").getAutoMapping()); assertEquals(Set.of("documentId", "tenantId", "version", "attempts"), configuration.getResultMap(ns + "RetryMap").getResultMappings().stream() .map(m -> m.getProperty()).collect(Collectors.toSet())); for (String name : Set.of("selectPending", "claim", "selectClaim", "finish")) { assertTrue(configuration.getMappedStatement(ns + name).getBoundSql(Map.of()).getSql().contains("f_tenant_id")); } } }